Skip to contentSkip to conversation

getting gitlab pipeline status

DISCUSSION Marek Marczykowski-Górecki 1 participant 1 message Aug 6, 2022

lore
Share & tools
lore
#0 lore raw

Hi,

Related to an IRC chat few days ago - here is how to get gitlab pipeline status:

# get latest pipeline of a branch
$ curl -s 'https://gitlab.com/api/v4/projects/xen-project%2Fxen/pipelines?ref=staging' | jq -r '.[0].status'
success
# get latest pipeline of a commit (example of success and failure)
$ curl -s 'https://gitlab.com/api/v4/projects/xen-project%2Fxen/pipelines?sha=6d6aee437e37fced0c49be97e08c30da873690fc' | jq -r '.[0].status'
success
$ curl -s 'https://gitlab.com/api/v4/projects/xen-project%2Fxen/pipelines?sha=da74c951e4e58080583daaad373b0d38a3f8bc83' | jq -r '.[0].status'
failed

Documentation:
https://docs.gitlab.com/ee/api/pipelines.html#list-project-pipelines

If making osstest push gate checking gitlab pipeline status is desirable (IMO that would be helpful), the above should be enough. I'm not fluent in osstest internals, but I hope it isn't too complex to add such check...

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab