Unable to parse YAML: mapping values are not allowed here Good morning. I'm migrating from Gitlab to CircleCI and try to map out a simple pipeline ("workflow") that basically should look like this:

[build] -&gt; [tests] -&gt; [release*]
* only on tags


I wasted endless hours literally copy-pasting example configs from the documentation. I defined three jobs:


build
tests
release


And I created a minimal workflow that just echos the job title, includes some requires (to map the pipeline) and have a condition that only triggers releases on tags.

However, I always get a YAML parsing error:

#!/bin/sh -eo pipefail
# Unable to parse YAML
# mapping values are not allowed here
#  in 'string', line 25, column 19:
#               requires:
#                       ^
# 
# -------
# Warning: This configuration was auto-generated to show you the message above.
# Don't rerun this job. Rerunning will have no effect.
false

Exited with code 1


This is my config.yaml that currently fails:

version: 2
jobs:
  build:
    steps:
      - run:
          name: Compile Binaries
          command: echo "Compile Binaries"
  tests:
    steps:
      - run:
          name: Run All Tests
          command: echo "Run All Tests"
  build:
    steps:
      - run:
          name: Release Artifacts
          command: echo "Release Artifacts"

workflows:
  version: 2
  minimal:
    jobs:
      - build
      - tests
          requires:
            - build
      - release
          requires:
            - tests
          filters:
            tags:
              only: /^v.*$/


I also tried online YAML validators but they always say this is valid YAML, so something is wrong with the way Circle expects the config to be. What could it be?



Edit: I managed to even minify the example that causes the exact same error:

jobs:
  build:
    steps:
      - run:
          name: Release Artifacts
          command: echo "Release Artifacts"

workflows:
  minimal:
    jobs:
      - release
          filters:
            tags:
              only: /^v.*$/


Causes:

#!/bin/sh -eo pipefail
# Unable to parse YAML
# mapping values are not allowed here
#  in 'string', line 12, column 18:
#               filters:
#                      ^
# 
# -------
# Warning: This configuration was auto-generated to show you the message above.
# Don't rerun this job. Rerunning will have no effect.
false

Exited with code 1
You simply have an incorrect yaml syntax in your workflows jobs list.

From what I could very quickly understand on circleCI's documentation, jobs names are accepted as a shorthand if you don't define any parameters. If you have parameters, the list element is a hashmap with top element being the job name. In your specific case, this should give (note the column after the names of jobs with params):

workflows:
  version: 2
  minimal:
    jobs:
      - build
      - tests:
          requires:
            - build
      - release:
          requires:
            - tests
          filters:
            tags:
              only: /^v.*$/