Menu

Why my GitLab CI monitor could never fire — child pipelines aren't listed by ref
📰

Why my GitLab CI monitor could never fire — child pipelines aren't listed by ref

DEV Community: cicd·Niyi Gbodimowo·3 days ago
#CszhHrvF
#devtocicd#devto#dev#pipeline#jobs
Long article (758 words) — no AI summary yet.
Reading 0:00
15s threshold

I'm the founder of Kilimanjaro , and this week's note is about a monitoring script that looked like it was working for as long as nothing went wrong.

We release by pushing a tag. A script watches the pipeline for that tag and tells us when it finishes, and which job failed if one did. For a while it did exactly that. Then a shard failed in a tag pipeline, and the script said the pipeline was still running, with no jobs, until we gave up and looked ourselves.

The symptom

The watcher was the obvious one. List the pipelines for the tag, take the newest, read its jobs:

pid = $( curl -s --header "PRIVATE-TOKEN: $TOKEN" \ "$API/projects/$PROJECT/pipelines?ref=$TAG" | jq '.[0].id' )

curl -s --header "PRIVATE-TOKEN: $TOKEN" \ "$API/projects/$PROJECT/pipelines/$pid/jobs" | jq '[.[] | select(.status=="failed")]'

Enter fullscreen mode

Exit fullscreen mode

The first call returned a pipeline with status running . The second returned [] . No failed jobs, no jobs at all.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.