"Cannot find a job named `build`..." error only when triggering build through API

I have a 2.0 build which runs successfully when triggered through a git commit. However, I am also trying to trigger the same build through the CircleCI API and receiving the error:

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

There are similar posting on the forum however I haven’t found any with this specific scenario (working through git commit but failing through the API.

My config.yml has arbitrary job names and includes a workflows section:

version: 2
workflows:
  version: 2
  test:
    jobs:
      - test-1
      - test-2
jobs:
  test-1: 
.
.
.
  test-2:
.
.
.

I am using the following API request:

curl -X POST -u <token>: https://circleci.com/api/v1.1/project/github/<repo>/tree/master

Thanks

Just found the documentation that explains that workflows cannot be triggered using the usual build endpoint. Instead “Build Processing” needs to be enabled and the new " Trigger a new Build by Project" endpoint needs to be used.

I followed the instructions and now it works. However, the new problem I have is that the new endpoint does not return the build number. So, I cannot query the status of the build that I triggered.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.