GitLab CI: pass artifacts via environment variables

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

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).

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

Edited Aug 04, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading