Skip to content

Implement expand/raw logic for basic jobs

Furkan Ayhan requested to merge 353991-fa-ci-variables-expand-raw-logic-1 into master

What does this MR do and why?

In previous works (!98420 (merged)), we added the YAML syntax for expand. Now, we start using it.

This MR implements the raw support for basic job variables.

Related to #353991 (closed)

Note: We did not update the docs and CI schema because there will be a couple of steps before releasing and the changes are behind the FF ci_raw_variables_in_yaml_config (#375034 (closed)).

Implementation table

Step Status
Add expand syntax to CI config !98420 (merged)
Implement expand/raw logic for basic jobs <- HERE
Add QA test for raw variables in CI config YAML !103181 (merged)
Use expand/raw logic for variables passed by bridge/trigger !103190 (merged)
Add documentation and CI schema for expand/raw !103313 (merged)

Screenshots or screen recordings

Enable the FF

Feature.enable(:ci_raw_variables_in_yaml_config)

Example complex config:

variables:
  VAR7:
    value: "value 7 $CI_PIPELINE_ID"
    expand: false
  VAR8:
    value: "value 8 $CI_PIPELINE_ID"
    expand: false

rspec:
  script:
    - echo $VAR1
    - echo $VAR2
    - echo $VAR3
    - echo $VAR4
    - echo $VAR5
    - echo $VAR6
    - echo $VAR7
    - echo $VAR8
  variables:
    VAR1: "JOBID-$CI_JOB_ID"
    VAR2: "PIPELINEID-$CI_PIPELINE_ID and $VAR1"
    VAR3:
      value: "PIPELINEID-$CI_PIPELINE_ID and $VAR1"
      expand: false
    VAR4:
      value: "JOBID-$CI_JOB_ID"
      expand: false
    VAR5: "PIPELINEID-$CI_PIPELINE_ID and $VAR4"
    VAR6:
      value: "PIPELINEID-$CI_PIPELINE_ID and $VAR4"
      expand: false
    VAR7: "overridden value 7 $CI_PIPELINE_ID"

Result:

Screenshot_2022-10-31_at_15.04.41

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Furkan Ayhan

Merge request reports