Variables from a .gitlab-ci.yml file is not being resolved in inherited jobs.
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
When an internal variable is passed to the extended job, it is not resolved. Instead, the variable name is printed as "$variable_name".
Steps to reproduce
- Create a .gitlab-ci.yml file
- Add below code to ci.yml file
variables:
var_a:
value: ""
description: "Please provide var_a"
var_b:
value: "$PLATFORM_VARIABLE"
stages:
- stage_0
- stage_1
job_0:
stage: stage_0
script:
- echo "$var_b" #Output: 12345 || value is resolved and printed on console
job_1:
stage: stage_1
extends: .some_validation-job # script tag inside this validation job is printing '$var_b' for 'echo "$var_b"' command. Extended job is not resolving the variable '$var_b'.
variables:
var_a: ${var_a}
var_b: $var_b
before_script:
- echo "$var_a" #Output: ABCD
- echo "$var_b" #Output: $var_b || here also job is not resolving the value
allow_failure: false
Note: This pseudo pipeline code is provided to help understand the changes that caused the failure. The pipeline was working before the addition of the new variable var_b.
Example values:
- PLATFORM_VARIABLE: 12345
- var_a: ABCD
- var_b: 12345
- Execute pipeline through web trigger
What is the current bug behavior?
Extended job is not resolving the variable '$var_b'.
What is the expected correct behavior?
All variables must be resolved.
Relevant logs and/or screenshots
Edited by 🤖 GitLab Bot 🤖
