Trying to run simple postman API calls but getting
Error calling workflow: 'workflow'
My .circleci/config.yml
is
$ cat .circleci/config.yml
version: 2.1
orbs:
newman: postman/newman@0.0.2
jobs:
newman-collection-run:
executor: newman/postman-newman-docker
steps:
- checkout
- newman/newman-run:
collection: ./collection.json
collection.json
is at the root of the project and is the export from postman.
I am using the example from
https://circleci.com/orbs/registry/orb/postman/newman
which shows:
The "workflow" reference comes from the original example on the circleci site (not with newman) when I start building on this branch and I've replaced the config file contents in the branch and pushed it so not sure why this reference is coming up ?
Here is that original screen:
which I change to be:
and
If you read the line of the error you left out (see the build), you can see why there's an error calling the workflow:
# Error calling workflow: 'workflow'
# Cannot find a definition for job named build
This requirement is documented in the config file reference (emphasis mine):
If you are not using workflows, the
jobs
map must contain a job namedbuild
. Thisbuild
job is the default entry-point for a run that is triggered by a push to your VCS provider. It is possible to then specify additional jobs and run them using the CircleCI API.
But why is it looking for a job named build in a workflow named workflow? Because if you don't supply a workflow explicitly, CircleCI uses the following default:
workflows:
version: 2
workflow:
jobs:
- build
You can see this by using CircleCI's Local CLI to run circleci config process .circleci/config.yml
on the fixed version in Danny's answer.
This suggests another solution to the problem; rather than renaming the job, supply the workflow:
version: 2.1
orbs:
newman: postman/newman@0.0.2
jobs:
newman-collection-run:
executor: newman/postman-newman-docker
steps:
- checkout
- newman/newman-run:
collection: ./collection.json
workflows:
version: 2
workflow:
jobs:
- newman-collection-run
As a side note, while looking to see if I could figure what message you saw on the original failing build, this is what I was met with:
* 37737f0 - (HEAD -> master, origin/master, origin/HEAD) config (22 hours ago) <Michael Durrant>
* e04efa0 - config (22 hours ago) <Michael Durrant>
* e640e4e - merge into master (26 hours ago) <Michael Durrant>
|\
| * cc16160 - config (27 hours ago) <Michael Durrant>
| * 13e0ad5 - config (28 hours ago) <Michael Durrant>
| * e4df02c - config (28 hours ago) <Michael Durrant>
| * b287102 - config (28 hours ago) <Michael Durrant>
| * 14bd61c - config (28 hours ago) <Michael Durrant>
| * 0f81d84 - config (28 hours ago) <Michael Durrant>
| * ccd06b6 - config (28 hours ago) <Michael Durrant>
| * 2b909f3 - config (28 hours ago) <Michael Durrant>
| * 4b15bca - config (28 hours ago) <Michael Durrant>
| * 240c591 - config (28 hours ago) <Michael Durrant>
| * 50096a9 - config (28 hours ago) <Michael Durrant>
| * ad9fe60 - config (28 hours ago) <Michael Durrant>
| * 7c19205 - config (28 hours ago) <Michael Durrant>
| * 3c0a3b9 - config (28 hours ago) <Michael Durrant>
| * 2d1954e - config (29 hours ago) <Michael Durrant>
| * 4e1f087 - config (29 hours ago) <Michael Durrant>
| * 9413b68 - config (29 hours ago) <Michael Durrant>
| * 942d493 - config (29 hours ago) <Michael Durrant>
| * e8412b8 - config (29 hours ago) <Michael Durrant>
| * c136702 - Add .circleci/config.yml (30 hours ago) <Michael Durrant>
| * 2203710 - Add .circleci/config.yml (30 hours ago) <Michael Durrant>
| * 94a084e - Add .circleci/config.yml (30 hours ago) <Michael Durrant>
| * ec40356 - Add .circleci/config.yml (30 hours ago) <Michael Durrant>
| * 6964057 - Add .circleci/config.yml (30 hours ago) <Michael Durrant>
* | 4e5c9d1 - coinfig (30 hours ago) <Michael Durrant>
* | cbf49fd - workflow name (30 hours ago) <Michael Durrant>
* | 6245ae1 - workflow name (30 hours ago) <Michael Durrant>
* | fdf52b5 - workflow name (30 hours ago) <Michael Durrant>
* | 0c4c455 - workflow name (30 hours ago) <Michael Durrant>
|/
* 7c31fb6 - update circleci config (30 hours ago) <Michael Durrant>
This isn't a healthy way to work with git; if you're not going to give your future self enough context to understand what is changing, I would recommending squashing out all the redundant commits when you bring the changes into master.
Note you can get the error messages for basic config file failures locally with the CLI by running circleci config validate
, which saves the loop of pushing all of those commits that can't work.