Config workflow validation error

I am new to CircleCi and worked a lot on my config the last days.
Now I changed my workflow, so that it should only run when my git commit is tagged with “build”. And if the “test” succeeds the “deploy” job should run.

workflows:
  version: 2
  build-and-deploy:
    jobs:
      - test:
        filters:
          tags:
            only: build
      - deploy:
        requires:
          - test

When I validate the config locally or run it only I get the following error:

ERROR IN CONFIG FILE:
[#/workflows/build-and-deploy/jobs/1] 0 subschemas matched instead of one
1. [#/workflows/build-and-deploy/jobs/1] expected type: String, found: Mapping
| SCHEMA:
| type: string
| INPUT:
| deploy: null
| requires:
| - test
| filters:
| branches:
| only: master
2. [#/workflows/build-and-deploy/jobs/1] 2 schema violations found
| 1. [#/workflows/build-and-deploy/jobs/1] maximum size: [1], found: [2]
| | SCHEMA:
| | maxProperties: 1
| | INPUT:
| | deploy: null
| | requires:
| | - test
| | filters:
| | branches:
| | only: master
| 2. [#/workflows/build-and-deploy/jobs/1/requires] expected type: Mapping, found: Sequence
| | SCHEMA:
| | type: object
| | INPUT:
| | - test

Could anyone help me what I am missing here?

I think filters: and requires: need to be indented, unless that’s based on how you pasted them here.

2 Likes

Thanks for the help. That fixed it for me. Must have overlooked that, but strange that YAML validators accepted the config.

1 Like

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