Using multiple `extends` can lead to unexpected results
While trying to use extends, I found several problems that I reproduced in this test project: https://gitlab.com/rymai/extends-issue/blob/master/.gitlab-ci.yml / https://gitlab.com/rymai/extends-issue/pipelines/36758225):
Implicit stage
-
Extending from a first job with an explicit
stage, then from a second job without an explicitstageresults in the implicitteststage from the second job being used, e.g. https://gitlab.com/rymai/extends-issue/-/jobs/121132154. -
Inverting the
extendssolves the problem so that the explicit stage from the last job extended is used
Implicit before_script
- Extending from a first job with an explicit
before_script, then from a second job without an explicitbefore_scriptresults in a globalbefore_scriptbeing used, e.g. https://gitlab.com/rymai/extends-issue/-/jobs/121132154
Implicit script
- Extending from a first job with an explicit
script, then from a second job without an explicitscriptresults in the implicitnilscriptfrom the second job being used, leading to a CI lint errorjobs:extends_from_second script can't be blank, e.g. https://gitlab.com/rymai/extends-issue/pipelines/36755431