I have a following usecase that I need help with.
Let’s suppose there is a GitLab CI pipeline composed of 2 stages with 3 jobs. There are two build jobs that generate large artifacts and a “notification” job that needs to send a Slack message containing links to those jobs’ artifacts:
stages: - build - notify build:a: stage: build image: $BUILDER_A_IMAGE script: - make build artifacts: - name: release-a - paths: - build/release-a/ build:b: stage: build image: $BUILDER_B_IMAGE script: - make build_b artifacts: - name: release-b - paths: - build/release-b/ notify: stage: notify image: $TOOLING_IMAGE # Do not download built artifacts, they are huge dependencies:  script: - | release_a="build/release-a/main-file" release_b="build/release-b/main-file" # FIXME release_a_link="$CI_JOB_URL/artifacts/file/$release_a" # FIXME release_b_link="$CI_JOB_URL/artifacts/file/$release_b" cat >/notify <<EOF *Release A:* <$release_a_link|main-file> *Release B:* <$release_b_link|main-file> EOF - /scripts/slack-notify.sh /notify
Originally, all of these actions were performed in a single job, and I could simply use
$CI_JOB_URL to generate links to the (future) artifacts of this job. Now this is no longer possible.
Is there a way to access the previous jobs’ IDs or URLs from the “notify” job? Or maybe a more idiomatic way of doing the whole thing?