github.com/drone/go-convert@v0.0.0-20240307072510-6bd371c65e61/convert/gitlab/yaml/testdata/job_keywords/rules/variables.yaml (about)

     1  # https://docs.gitlab.com/ee/ci/yaml/#rulesvariables
     2  
     3  job:
     4    variables:
     5      DEPLOY_VARIABLE: "default-deploy"
     6    rules:
     7      - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
     8        variables:                              # Override DEPLOY_VARIABLE defined
     9          DEPLOY_VARIABLE: "deploy-production"  # at the job level.
    10      - if: $CI_COMMIT_REF_NAME =~ /feature/
    11        variables:
    12          IS_A_FEATURE: "true"                  # Define a new variable.
    13    script:
    14      - echo "Run script with $DEPLOY_VARIABLE as an argument"
    15      - echo "Run another script if $IS_A_FEATURE exists"