CircleCI API的行为与github提交触发器不同吗? [英] CircleCI API behaving differently from github commit trigger?

查看:212
本文介绍了CircleCI API的行为与github提交触发器不同吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 cypress-example-kitchen接收器应用程序 CircleCI.

I'm running the cypress-example-kitchen sink app on CircleCI.

这是我的Yaml配置脚本:

This is my yaml config script:

version: 2.1
orbs:
  cypress: cypress-io/cypress@1.0.1
workflows:
  build:
    jobs:
      - cypress/install:
          build: 'npm run build'
      - cypress/run:
          requires:
            - cypress/install
          start: 'npm start'

当我对我上面的仓库的分支进行提交时,它开始并且通过就很好了.

This kicks off and passes just fine when I make a commit to my fork of the repo above.

但是,当我尝试以编程方式执行CircleCI构建时,使用 curl -X POST https://circleci.com/api/v1.1/project/github/Atticus29/cypress-example-kitchensink?circle-token=myApiToken,构建失败,CircleCI上的作业仪表板告诉我我的配置文件有问题:

However, when I try to execute a CircleCI build programmatically, using curl -X POST https://circleci.com/api/v1.1/project/github/Atticus29/cypress-example-kitchensink?circle-token=myApiToken, the build fails and the jobs dashboard on CircleCI tells me that something is wrong with my config file:

发现6个架构冲突未找到所需的关键[工作]工作流程: 找到5个架构违规 工作流程:最小大小:[2],找到: 1 工作流程:构建:作业:发现4个架构冲突 工作流程:构建:作业:0:0匹配的子方案,而不是一个 工作流:构建:作业:0:预期类型:字符串,找到:映射 工作流程:构建:作业:0:安装:无关的密钥[构建]不允许 工作流程:构建:职位:1:0匹配的子方案,而不是一个 工作流程:构建:职位:1:预期类型:字符串,找到:映射 工作流程:构建:作业:1:运行:无关的键[开始]不允许

6 schema violations found required key [jobs] not found workflows: 5 schema violations found workflows: minimum size: [2], found: 1 workflows: build: jobs: 4 schema violations found workflows: build: jobs: 0: 0 subschemas matched instead of one workflows: build: jobs: 0: expected type: String, found: Mapping workflows: build: jobs: 0: install: extraneous key [build] is not permitted workflows: build: jobs: 1: 0 subschemas matched instead of one workflows: build: jobs: 1: expected type: String, found: Mapping workflows: build: jobs: 1: run: extraneous key [start] is not permitted

我的构建出了点问题:

Build-agent版本0.1.1216-48f80d08(2018-12-07T16:01:40 + 0000) 配置错误:发生2个错误:

Build-agent version 0.1.1216-48f80d08 (2018-12-07T16:01:40+0000) Configuration errors: 2 errors occurred:

  • 配置版本2.1需要启用生成处理"项目设置.在项目设置->下启用构建处理 高级设置.为了重新触发构建处理,您必须 推送新的提交.
  • 在配置文件的jobs:部分中找不到要运行的名为build的作业.如果您希望运行工作流程,请检查您的 config包含一个称为"workflows:"的顶级密钥.
  • Configuration version 2.1 requires the "Enable Build Processing" project setting. Enable Build Processing under Project Settings -> Advanced Settings. In order to retrigger build processing, you must push a new commit.
  • Cannot find a job named build to run in the jobs: section of your configuration file. If you expected a workflow to run, check your config contains a top-level key called 'workflows:'

我可以确认启用构建处理"已启用.

I can confirm that Enable Build Processing is on.

当我以通常的方式运行构建时,这些都不是问题.有什么建议吗?

None of these were problems when I ran the build in the usual way. Any advice?

推荐答案

尽管出于某种原因,循环CI仍假定未针对v2.0设置项目,尽管config.yml被称为正确的东西并且生活在正确的环境中放置在仓库中.经过几次提交后,这个问题似乎消失了?

Circle CI for some reason keeps on assuming that the projects are not set up for v2.0 despite config.yml being called the right thing and living in the right place in the repo. After a few commits, this issue seems to go away?

我最终使用以下脚本以编程方式运行了构建:

I ended up running a build programmatically with the following script:

#!/bin/bash

PERSONAL_TOKEN=myPersonalTokenHere

MOST_RECENT_BUILD=`curl -s "https://circleci.com/api/v1.1/recent-builds?circle-token=$PERSONAL_TOKEN&limit=1"| grep 'build_num'|grep -o '\d.'|sed 's/,//g'|sort -r -n|head -n1`

curl -X POST "https://circleci.com/api/v1.1/project/github/holmbergius/wildMeCypress/$MOST_RECENT_BUILD/retry?circle-token=$PERSONAL_TOKEN"

这篇关于CircleCI API的行为与github提交触发器不同吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆