Reputation: 97
in gitlab I have a "job1" that sometimes does not start whatsoever due to various reason and I can't change that. When that job is skipped, then the artifacts for the job is not created.
My question is, is there a way for job2 to check if the artifact from job1 exists? It is not a question of whether or not we can fix job1 to make it always send the artifact, it is a question of how can I check if the "art.txt" file is there or not
Upvotes: 0
Views: 4341
Reputation: 1234
if job1 create artifact art.txt fail, job1 status will fail. you can used dependencies
, when job1 failure job2 will not start, maybe look like:
job1:
stage: stage1
script:
- create art.txt
artifact:
paths:
- art.txt
job2:
stage: stage2
script:
- do something.
dependencies:
- job1
if job1 create artifact art.txt fail, job1 status will success. you can check art.txt status used shell script in job2 script section. look lik
job2:
stage: stage2
script:
- |
if [[ -f art.txt ]]; then
"is exist";
else
"is not exist";
exit 1;
fi;
dependencies:
- job1
Upvotes: 1