‘’’
stages:
- first
variables:
test_var: “2”
.first: &first
tags:
- linux
variables:
internal_var: “10”
script: - echo $test_var
- echo $internal_var
my_job:
<<: *first
stage: first
when: manual
variables:
test_var: “3”
‘’’
Running with gitlab-runner 15.7.0~beta.2.gbefba8c4 (befba8c4)
on my_gitlab 3BsN_Sha
Preparing the “shell” executor
00:00
Using Shell executor…
Preparing environment
00:01
Running on my_gitlab…
Getting source from Git repository
00:00
Fetching changes with git depth set to 20…
Reinitialized existing Git repository in /home/gitlab-runner/builds/3BsN_Sha/0/otto/expand/.git/
Checking out 6175a97b as main…
Skipping Git submodules setup
Executing “step_script” stage of the job script
00:00
$ echo $test_var
3
$ echo $internal_var
Job succeeded
internal_var is null
‘’’
stages:
- first
variables:
test_var: “2”
.first: &first
tags:
- linux
variables:
internal_var: “10”
script: - echo $test_var
- echo $internal_var
my_job:
<<: *first
stage: first
when: manual
variables:
test_var: “3”
internal_var: “11”
‘’’
Running with gitlab-runner 15.7.0~beta.2.gbefba8c4 (befba8c4)
on my_gitlab 3BsN_Sha
Preparing the “shell” executor
00:00
Using Shell executor…
Preparing environment
00:00
Running on my_gitlab…
Getting source from Git repository
00:00
Fetching changes with git depth set to 20…
Reinitialized existing Git repository in /home/gitlab-runner/builds/3BsN_Sha/0/otto/expand/.git/
Checking out 8a7c9a52 as main…
Skipping Git submodules setup
Executing “step_script” stage of the job script
00:00
$ echo $test_var
3
$ echo $internal_var
11
Job succeeded
as you see internal_var is defined
How can I use variable on anchor?
Thank you