Skip to content

Variables from artifacts:reports:dotenv not expanded in job variables block #1492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cheeming opened this issue Feb 4, 2025 · 0 comments · Fixed by #1488
Closed

Variables from artifacts:reports:dotenv not expanded in job variables block #1492

cheeming opened this issue Feb 4, 2025 · 0 comments · Fixed by #1488

Comments

@cheeming
Copy link

cheeming commented Feb 4, 2025

Executed with gitlab-ci-local --cwd . with the following .gitlab-ci.yml file
Minimal .gitlab-ci.yml illustrating the issue

$ cat .gitlab-ci.yml
build1:
  stage: build
  image: alpine
  script:
    - echo "PARAM1=abc123" >> test1.env
  artifacts:
    reports:
      dotenv: test1.env

test1:
  stage: test
  image: alpine
  variables:
    PARAM2: 'hello:${PARAM1}'
  script:
    - echo build_image1=${PARAM2}
    - echo build_image2="world:${PARAM1}"

Expected behavior (as tested in Gitlab.com) for test1 job, PARAM1 should be expanded, check the line that runs the command echo build_image1=${PARAM2}

Running with gitlab-runner 17.7.0~pre.103.g896916a8 (896916a8)
  on green-3.saas-linux-small-amd64.runners-manager.gitlab.com/default Jhc_Jxvh, system ID: s_0e6850b2bce1

Preparing the "docker+machine" executor
00:06
Using Docker executor with image alpine ...
Pulling docker image alpine ...
Using docker image sha256:b0c9d60fc5e3fa2319a86ccc1cdf34c94c7e69766e8cebfb4111f7e54f39e8ff for alpine with digest alpine@sha256:56fa17d2a7e7f168a043a2712e63aed1f8543aeafdcee47c58dcffe38ed51099 ...

Preparing environment
00:00
Running on runner-jhcjxvh-project-66365610-concurrent-0 via runner-jhcjxvh-s-l-s-amd64-1738663680-ad04a05d...

Getting source from Git repository
00:01
Fetching changes with git depth set to 20...
Initialized empty Git repository in /builds/canterly/oidc-test1/.git/
Created fresh repository.
Checking out bef15ffe as detached HEAD (ref is main)...
Skipping Git submodules setup
$ git remote set-url origin "${CI_REPOSITORY_URL}"

Executing "step_script" stage of the job script
00:01
Using docker image sha256:b0c9d60fc5e3fa2319a86ccc1cdf34c94c7e69766e8cebfb4111f7e54f39e8ff for alpine with digest alpine@sha256:56fa17d2a7e7f168a043a2712e63aed1f8543aeafdcee47c58dcffe38ed51099 ...
$ echo build_image1=${PARAM2}
build_image1=hello:abc123
$ echo build_image2="world:${PARAM1}"
build_image2=world:abc123

Cleaning up project directory and file based variables
00:00
Job succeeded

Actual behavior with gitlab-ci-local for test1 job, PARAM1 is not expanded (check the line that runs the command echo build_image1=${PARAM2})

$ gitlab-ci-local --cwd .
parsing and downloads finished in 29 ms.
json schema validated in 58 ms
build1 starting alpine:latest (build)
build1 copied to docker volumes in 342 ms
build1 $ echo "PARAM1=abc123" >> test1.env
build1 finished in 2.21 s
build1 exported artifacts in 297 ms
build1 copied artifacts to cwd in 21 ms
test1  starting alpine:latest (test)
test1  copied to docker volumes in 250 ms
test1  imported artifacts in 28 ms
test1  $ echo build_image1=${PARAM2}
test1  > build_image1=hello:
test1  $ echo build_image2="world:${PARAM1}"
test1  > build_image2=world:abc123
test1  finished in 552 ms

 PASS  build1
 PASS  test1
pipeline finished in 3.2 s

Host information
macOS Sequoia
gitlab-ci-local 4.56.2 and 4.57.0

Containerd binary
N/A

Additional context
N/A

@cheeming cheeming changed the title Variables from artifact not expanded in job variables block Variables from artifacts:reports:dotenv not expanded in job variables block Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant