Clarification on passing dependencies between stages
Problem to solve
The docs for Gitlab CI yaml configuration are confusing regarding the passing of dependencies. Link to the docs.
They state the following:
Note that artifacts from all previous stages are passed by default.
Later on in the example the following is shown:
Stages:
- Build
- Test
- Deploy
Then within the test
stage it defines dependencies to the artifacts from build
stage explicitly, while the deploy
job does not state any dependencies. This is very confusing:
- Are artifacts automatically passed to jobs from previous stages?
- If yes: Why do the test-jobs need to explicitly define the dependencies then? They should automatically have access, their stage is after the
build
stage - If no: Why does the
deploy
job NOT need to define the dependencies?
- If yes: Why do the test-jobs need to explicitly define the dependencies then? They should automatically have access, their stage is after the
I could understand that dependencies makes sense when jobs are depending on each other when they are placed within the same stage. E.g. build:linux
depends on some artifacts from build:osx
. But this is not what's being shown in the docs...
In addition my practical experience is that artifacts are NOT automatically given to jobs from later stages. You need to explicitly declare the dependencies in order for them to be available to the job. This also means that with the given example the deploy
job will never have access to the artifacts - even if stated otherwise.
What product or feature(s) affected?
Gitlab CI documentation
What docs or doc section affected? Include links or paths.
Proposal
- Check the real behaviour of how
dependencies
work and change the docs accordingly - Perhaps even review if the feature is working as expected (perhaps the docs are right, but the feature does not work as intended).
Who can address the issue
Anyone from the Gitlab CI or docs team