Skip to content

CI Linter should Detect duplicate job names

Problem to solve

The CI linter doesn't give an error/warning if two jobs have the same name.

Further details

This yaml passes the CI linter.

one:
  script:
    - echo one

two:
  script:
    - echo two

two:
  script:
    - echo "two again"

That's reasonable, as I believe it is correct/valid yaml. However in the context of gitlab-ci.yaml surely no-one would ever want this. I think it would be more helpful if this didn't pass the linter, rather than silently not running a job someone thought they defined.

Proposal

Duplicate job names (or any key in a dictionary) should be detected by the linter, and prevent a pipeline from running. This would make the checks the linter runs more useful.

Edited by Mark Fletcher