needs:pipeline:job:artifacts: true
checks for job success instead of artifacts presence
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
In parent-child pipelines when needs:pipeline:job:artifacts: true
is set, the child pipeline won't start when the job from parent mentioned in 'needs' fails. The child job won't start with an error This job could not start because it could not retrieve the needed artifacts.
despite artifacts being present in the failed job.
Steps to reproduce
# .gitlab-ci.yml:
stages:
- parent-stage-01
- parent-stage-02
parent-stage-job-01:
stage: parent-stage-01
script:
- echo "MY_UNIT_JOB_ID=$CI_JOB_ID" >> build.env
- exit 1 #uncomment this to simulate a failed job
artifacts:
reports:
dotenv: build.env
when: always
parent-stage-job-triggering-child:
stage: parent-stage-02
variables:
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
trigger:
include: child-pipeline.gitlab-ci.yml
strategy: depend
when: always
# child-pipeline.gitlab-ci.yml:
stages:
- child-stage-01
child-stage-job-01:
stage: child-stage-01
script:
- echo $MY_UNIT_JOB_ID #expected from parent job artifact
needs:
- pipeline: $PARENT_PIPELINE_ID
job: parent-stage-job-01
artifacts: true
When parent-stage-job-01
job fails, parent-stage-job-triggering-child
job fails with This job could not start because it could not retrieve the needed artifacts.
error. This seems wrong as the parent always exports artifacts.
Changing to artifacts: false
makes the job start. Example pipeline: https://gitlab.com/gitlab-gold/kategrechishkinatestgroup/ci-cd-tests/trigger-test/-/pipelines/582372109
Example Project
What is the current bug behavior?
job fails with This job could not start because it could not retrieve the needed artifacts.
error
What is the expected correct behavior?
The child job should start.
Output of checks
This bug happens on GitLab.com