CircleCI API 与 github 提交触发器的行为不同?

CircleCI API behaving differently from github commit trigger?

我是 CircleCI 上的 运行 cypress-example-kitchen sink app

这是我的 yaml 配置脚本:

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'

当我对上面的回购的分支进行提交时,这开始并顺利通过。

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

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 version 0.1.1216-48f80d08 (2018-12-07T16:01:40+0000) Configuration errors: 2 errors occurred:

  • 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:'

我可以确认启用构建处理已打开。

None 这些是我 运行 以通常方式构建时出现的问题。有什么建议吗?

Circle CI 出于某种原因继续假设项目不是为 v2.0 设置的,尽管 config.yml 被称为正确的东西并且在 repo 中的正确位置。几次提交后,这个问题似乎消失了?

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

#!/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"