I'm running custom pipelines that take variables, and I'd like to be able to retrieve the {key: val} pairs for the variables when fetching a pipeline from the API.
I can see that there's endpoints for repository, workspace and environment variables, but I need the key-value pairs specified when the pipeline is launched.
I've looked through the pipeline response from
GET /2.0/repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}
and step response from
GET /2.0/repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}
and they don't seem to be included. Pipeline response does have a 'has_variables' boolean, but I'm not sure if this refers to the custom pipeline variables or other types.
Just want to know if this is possible, as I can work around it otherwise.
Cheers!
I'm afraid that this is not possible with the pipeline or step endpoint.
The values of these variables are visible in the Pipelines log, in the "Build setup", which can be retrieved with the endpoint
GET /2.0/repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/log
You would then need to parse the log to get the value of each variable.
Kind regards,
Theodora
No problem, thanks for letting me know
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are very welcome, please feel free to reach out if you ever need anything else!
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
We are in 2024, is-it still the only option to get access to the variables set during the pipeline launch via API?
Because the API documentation show us a nice `variables` prop in the `list pipelines` operation ;)
{
"page": 102,
"values": [
{
"type": "<string>",
"uuid": "<string>",
"build_number": 33,
"creator": {
"type": "<string>"
},
"repository": {
"type": "<string>"
},
"target": {
"type": "<string>"
},
"trigger": {
"type": "<string>"
},
"state": {
"type": "<string>"
},
"variables": [
{
"type": "<string>"
}
],
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Julien,
The option mentioned in my answer above is the only one at the moment.
The "variables" property is not returned with the pipeline endpoint, I have reached out to my team internally to remove this from our docs in order to avoid confusion.
I also created a feature request for returning custom pipelines' variables and their values via API:
You can add your vote to it (by selecting the Vote for this issue link) to express your interest and you can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to be notified via email on updates.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi, thanks for the update and the documentation clarification! I will check the feature request creation to vote for it!
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.