Passing an environment variable to another job is not working with `artifacts:access: 'none'`
Summary
We have a pipeline that passes an environment variable (and a file artifact) from job 1 to job 2. Therefore, we use artifacts:reports:dotenv in job 1 as described in the docs.
While this config worked perfectly in the last weeks, the environment variable in job 2 is now empty.
Steps to reproduce
stages:
- check
job-1:
stage: .pre
script:
- echo "BUILD_VARIABLE=path/to/secret/config" > tf.env
artifacts:
access: 'none' # We don't want users to download the config file
paths:
- path/to/secret/config
reports:
dotenv: tf.env
job-2:
stage: check
script:
- echo "$BUILD_VARIABLE" # This is empty!
- cat path/to/secret/config # This file exists (as expected)
We noticed that if we remove access: 'none' it works as expected. However, denying access to this artifact is mandatory for us and it worked previously.
Example Project
What is the current bug behavior?
The environment variable BUILD_VARIABLE is empty in job-2.
What is the expected correct behavior?
The environment variable BUILD_VARIABLE has the value path/to/secret/config in job-2.
Relevant logs and/or screenshots
access: 'none' |
access: 'all' |
|---|---|
![]() |
![]() |
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)

