Skip to content

Stricter CI Linter

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.

What does success look like, and how can we measure that?

I'm not sure how success could be measured. It would stop people wasting time when they have this 'error' in their ci yaml, and it isn't immediately obvious what's going on.

Links / references

https://gitlab.com/gitlab-org/gitlab-ce/issues/49285