How can I get the CI/CD variables defined for a project's pipeline execution

#1

There is a web service that does provide me all the variables defined for a project’s CI/CD.

curl --header “PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK” “https://gitlab.example.com/api/v4/projects/1/variables

However , if I have multiple users sharing the same project or if pipeline takes a while to complete and multiple executions are kicked off at the same time, I have no idea what were the exact variables that were defined for that pipeline.

Is there a way to get that information? Ideally I was hoping all the variables would be stored somewhere for every Pipeline execution, but I couldn’t see them even in the ci_pipeline_variables table either:(

Does anyone know?

1 Like
#2

Does no one know how to get the variables used to kick off an old pipeline?

#3

You could take the job and pipeline ID. Does it fit your request?

#4

Hi Marco, Thank you.
Is this what you are talking about. Do we know when this was introduced as I can’t find it in my install which is at Community edition 11.6.3 .

https://docs.gitlab.com/ce/api/pipelines.html#get-variables-of-a-pipeline

This APi works for a project 1, pipeline 46

curl --header “PRIVATE-TOKEN: <your_access_token>” “https://gitlab.example.com/api/v4/projects/1/pipelines/46

However the variables doesn’t work. Maybe this API is not available in my current release. any idea how to tell , when this was released

curl --header “PRIVATE-TOKEN: <your_access_token>” “https://gitlab.example.com/api/v4/projects/1/pipelines/46/variables

1 Like