GitLab CI: pass artifacts via environment variables
First, a little more convenient way to pass data between stages without having to read/source artifact files.
job1: artifacts: variables: - SOME_RESULT script: - export SOME_RESULT="hello world" job2: script: - echo $SOME_RESULT # prints: hello world
Second, and foremost, an extremely convenient way for all-dynamic variable substitution.
job1: artifacts: variables: - IMAGE_TAG script: - export IMAGE_TAG="docker tag name dynamically generated" job2: image: company/project:$IMAGE_TAG script: - # do whatever
Whether it's part of "artifacts", or named differently, it doesn't matter. However, naming it "artifacts" would imply similar behavior - e.g. an artifact variable won't be passed if it's not listed as a dependency (when dependencies are defined).