I have a job which is maintained by a team, let's call it docs. It runs in a pipeline with jobs maintained by other teams. If the docs team job succeeds, I want to download artifact regardless of the other jobs which impact the pipeline status. An example of this is as follows,
#!/bin/sh
mkdir foo;
cd foo;
git init;
glab repo create;
GLCI=.gitlab-ci.yml
cat > "$GLCI" <<'EOF'
image: alpine:latest
stages:
- build
fail:
stage: build
script:
- exit 42 # failure
build:
stage: build
script:
- mkdir dist
- echo "0" > dist/bar.txt
artifacts:
expire_in: 5 seconds
paths:
- dist/*
EOF
#commit ci
git add "$GLCI";
git commit -m 'Add gitlab ci';
git branch --set-upstream-to=main
git push --set-upstream -o ci.skip origin main;
echo bump > test.txt
git add test.txt
git commit -a -m'bump';
git push;
In the above we have two jobs in a pipeline, build
(which passes) and fail
(which fails). I want to download the last build
job's artifact factoring in nothing but the job status.
The end point, Download a single artifact file from specific tag or branch in the Artifacts API almost does what I want, but it only triggers on successful pipelines,
Download a single artifact file for a specific job of the latest successful pipeline for the given reference name from inside the job’s artifacts archive. The file is extracted from the archive and streamed to the client, with the plain/text content type.
How can I work around this limitation? How can this be done?