- Issue created by @jonathan1055
- 🇬🇧United Kingdom jonathan1055
The above order is what we have mostly been following, but I thought it worth taking a look to see what other developers do, and/or if there is consensus
Tim Plavec on Medium suggests an order that is fairly close to what we are already are doing:
https://tinplavec.medium.com/gitlab-ci-cd-best-practices-i-recommend-aft...extends stage needs rules tags << we do not use tags image environment << we do not use variables script allow_failure artifacts cache << we do not use
He does not have 'services' in his list. I have not found any other recommended orderings.
His idea of having artifacts at the end sounds quite good. They are logically produced by the script, at the end of the job.
It would also be quite easy to write a simple script to verify the order in our two files, but Gitlab Templates own .gitllab-ci.yml, and run this as part of our code checks. We won't be adding too many new items very often, but the script would help us to get the order right, and keep it so.
- 🇬🇧United Kingdom jonathan1055
Initial commit, with a php script to check the keyword order. It failed as intended, because I have not moved any of the keywords, and also left some undefined, to demonstrate the output.
Tangentially related, I noticed that the project's
.gitlab-ci.yml
is being ignored by the eslint check. We do not have a .eslintignore or .prettierignore file, and even using--no-ignore
locally this file is still not tested. I adde--debug
to check what happens in the pipeline, and it is ignored just like when running locally, and I don't know why.2025-04-12T16:55:27.106Z eslintrc:ignore-pattern Check { filePath: '/builds/issue/gitlab_templates-3518793/.gitlab-ci.yml', dot: false, relativePath: '.gitlab-ci.yml', result: true } 2025-04-12T16:55:27.106Z eslint:file-enumerator Yield: .gitlab-ci.yml but ignored