File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -295,7 +295,30 @@ jq -r '.mcpServers.gitlab.env.GITLAB_PERSONAL_ACCESS_TOKEN' ~/.claude.json
295295curl -s -H " PRIVATE-TOKEN: <TOKEN>" " https://gitlab.ddbuild.io/api/v4/projects/355/jobs/<JOB_ID>/trace" | tail -200
296296```
297297
298+ ### Monitoring CI Jobs
299+
300+ Use the helper script to check job status:
301+
302+ ``` bash
303+ # Check helper-rust jobs in a pipeline (use numeric pipeline ID, not IID)
304+ ./scripts/check-ci-jobs.sh < PIPELINE_ID> helper-rust
305+ ```
306+
307+ To monitor a pipeline until completion and get notified, spawn a background agent with this prompt:
308+
309+ ```
310+ Monitor GitLab pipeline <PIPELINE_ID> for helper-rust jobs. Run this loop:
311+ 1. Run: ./scripts/check-ci-jobs.sh <PIPELINE_ID> helper-rust
312+ 2. Parse the output to get RUNNING, PASSED, FAILED counts
313+ 3. If FAILED > 0, use speak MCP to say "X helper rust jobs failed" and STOP
314+ 4. If RUNNING > 0:
315+ - First iteration: wait 60 seconds
316+ - Subsequent iterations: wait 300 seconds
317+ - Then repeat from step 1
318+ 5. When RUNNING == 0 and FAILED == 0, use speak MCP to say "All helper rust jobs passed"
319+ ```
320+
298321## Misc Notes
299322
300- - Always ask for confirmation before reverting anything with git
323+ - Always ask for confirmation before reverting, committing, or pushing anything with git
301324- Do not run commands with simply tail, as that prevents checking the progress. If you're to use tail, use also tee /tmp/< ; logfile> ;
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Check status of helper-rust CI jobs in a GitLab pipeline
3+ # Usage: check-ci-jobs.sh <pipeline_id> [job_filter]
4+ # Example: check-ci-jobs.sh 91141215 helper-rust
5+ # Note: Use the numeric pipeline ID (not IID) from the child appsec pipeline
6+
7+ set -e
8+
9+ PIPELINE_ID=" ${1:? Pipeline ID required} "
10+ JOB_FILTER=" ${2:- helper-rust} "
11+ PROJECT_ID=" 355"
12+ GITLAB_URL=" https://gitlab.ddbuild.io"
13+
14+ # Get token from MCP config
15+ GITLAB_TOKEN=$( jq -r ' .mcpServers.gitlab.env.GITLAB_PERSONAL_ACCESS_TOKEN' ~ /.claude.json)
16+
17+ if [ -z " $GITLAB_TOKEN " ] || [ " $GITLAB_TOKEN " = " null" ]; then
18+ echo " ERROR: Could not extract GitLab token from ~/.claude.json"
19+ exit 1
20+ fi
21+
22+ # Get jobs matching filter
23+ JOBS=$( curl -s -H " PRIVATE-TOKEN: $GITLAB_TOKEN " \
24+ " $GITLAB_URL /api/v4/projects/$PROJECT_ID /pipelines/$PIPELINE_ID /jobs?per_page=100" | \
25+ jq -r " .[] | select(.name | contains(\" $JOB_FILTER \" ))" )
26+
27+ if [ -z " $JOBS " ] || [ " $JOBS " = " " ]; then
28+ echo " ERROR: No jobs found matching filter '$JOB_FILTER ' in pipeline $PIPELINE_ID "
29+ exit 1
30+ fi
31+
32+ # Count statuses
33+ TOTAL=$( echo " $JOBS " | jq -s ' length' )
34+ RUNNING=$( echo " $JOBS " | jq -s ' [.[] | select(.status == "running" or .status == "pending" or .status == "created")] | length' )
35+ PASSED=$( echo " $JOBS " | jq -s ' [.[] | select(.status == "success")] | length' )
36+ FAILED=$( echo " $JOBS " | jq -s ' [.[] | select(.status == "failed")] | length' )
37+
38+ # Output summary
39+ echo " PIPELINE_ID=$PIPELINE_ID "
40+ echo " TOTAL=$TOTAL "
41+ echo " RUNNING=$RUNNING "
42+ echo " PASSED=$PASSED "
43+ echo " FAILED=$FAILED "
44+
45+ # Output job details
46+ echo " ---JOBS---"
47+ echo " $JOBS " | jq -r ' [.name, .status, .id] | @tsv'
You can’t perform that action at this time.
0 commit comments