Hey GitLab mates,
for a current project we looking to fetch pipeline jobs from the API.
Scope is to do all that within BASH scripts using cURL for querying.
So far we’re already getting out those fruits from beloved GitLab API:
pipeline_id=$(curl --header "PRIVATE-TOKEN: $GITLAB_PASSWORD" --silent "https://${GITLAB_HOSTNAME}/api/v4/projects/${GITLAB_PROJECT_ID}/repository/commits/${branch}" | jq '.last_pipeline.id')
ci_output=$(curl --header "PRIVATE-TOKEN: $GITLAB_PASSWORD" --silent "https://${GITLAB_HOSTNAME}/api/v4/projects/${GITLAB_PROJECT_ID}/pipelines/${pipeline_id}")
But we’re don’t grasp how to fetch all jobs run by a certain pipeline.
RTFM didn’t help us here https://docs.gitlab.com/ce/api/pipelines.html
The idea is to fetch somehow all the jobs IDs via something like:
https://${GITLAB_HOSTNAME}/api/v4/projects/${GITLAB_PROJECT_ID}/-/pipelines/${pipeline_id}/builds
For then looping over all those jobs IDs to get their output via:
https://${GITLAB_HOSTNAME}/api/v4/projects/${GITLAB_PROJECT_ID}/-/jobs/${GITLAB_JOB_ID/raw
Would be wonderful if someone could help us here how to access that