Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab CI - find the pipeline variables used

When you run a pipeline from the Gitlab UI, you are open to add variables to the run:

enter image description here

From the overview of finished pipelines, is there a way to find the set variables and values of specific runs?

like image 373
Joost Döbken Avatar asked Nov 17 '25 07:11

Joost Döbken


2 Answers

As far as I know, these are one time variables you set by running a pipeline manually. You cannot view the the variables in the UI. Instead, like @Origin said you can echo the variable in the job.

example:

script:
    - '& echo "$MY_VARIABLE"'

I would recommend you to save your variables in the default CI/CD Settings. (Settings -> CI/CD -> Variables). There you can set, save, protect (from other user roles) and view them for sure. These variables will be used in any pipeline run you do.

like image 71
T. Jami Avatar answered Nov 20 '25 05:11

T. Jami


On the latest versions of Gitlab (2025 something), you can use the workflow:name property in gitlab-ci.yml to display some of your pipeline variables values directly in the pipeline Title.

For example :

workflow:
  name: 'Deploy my artifact using branch=$CI_COMMIT_BRANCH and version=$MY_VERSION, choice=$MY_CHOICE'

variables:
  MY_VERSION:
    value: 3
    description: "artifact version"
  MY_CHOICE:
    value: "default"
    description: "your choice"
    options:
      - "default"
      - "choice1"
      - "choice2"

From my end I found it very useful.

like image 45
R. Du Avatar answered Nov 20 '25 05:11

R. Du