Dependencies that share job names with stages are ignored
I recently encountered an issue with the following .gitlab-ci.yml file:
stages:
- build
- deploy
build:
image: maven:3.5.0-jdk-8
stage: build
script:
- mvn package -q
artifacts:
paths:
- target/myapp.jar
deploy_prod:
image: maven:3.5.0-jdk-8
stage: deploy
only:
- master
dependencies:
- build
environment:
name: production
url: https://myapp.com
script:
- {{ deploy things }}
deploy_test:
image: maven:3.5.0-jdk-8
stage: deploy
only:
- test
dependencies:
- build
environment:
name: test
url: https://test.myapp.com
script:
- {{ deploy things }}
I expected the deploy_prod
and deploy_test
jobs to download artifacts from the build
job. This did not occur. The expected behavior occurred only when I renamed the build
job to something else and adjusted the corresponding dependencies. The artifacts then correctly were downloaded into the deploy_x
jobs.
I am not sure if this is intentional behavior or not, but it seemed odd to me so I wanted to bring it to someone's attention.
If it is intentional, I can submit a PR to add a warning on the .gitlab-ci.yml reference page about naming issues.