Config file:
version: 2
jobs:
run_tests:
docker:
- image: circleci/ruby:2.4.9-node-browsers
steps:
- checkout
- run: echo "Running tests"
workflows:
version: 2
build:
jobs:
- run_tests
This seems to work if I push a commit to github, but if I use the circleci api it fails. I have a feeling this may be a bug in the API, because it triggers the same commit to be built, and comes up with the following error:
Build-agent version 1.0.39420-c361fae8 (2020-09-09T11:04:48+0000)
Configuration errors: 1 error occurred:
* 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:'
Before asked I have already attempted to raise this with CircleCI directly but I have not received a response.
Hi @abepetrillo! When you says contacted CircleCI directly, does this mean you filed a support ticket? I’m asking so I can check on the status for you.
Apologies for not updating.
CircleCI did finally get back to me. There were a few issues. Firstly you can’t use v1 of the API with v2 of the config/circle.yml. Second we had some parsing issues with the variables.
I think as part of the support ticket they are updating the docs. The resulting code that used the API looks like this:
curl -vs -X POST https://circleci.com/api/v2/project/github/${ORGANIZATION}/${PROJECT}/pipeline -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Circle-Token: '"${CIRCLE_TOKEN}"''
Yes we are using a total of four quotes around the CIRCLE_TOKEN. This is because of the way bash translates the string.
1 Like