fix(testme-on-pr): read cc-ci/testme context URL not first-status URL

When multiple commit statuses exist (e.g. an Adversary probe + the real run),
the first status in the array may not be the cc-ci run. Filter by context
'cc-ci/testme' to get the correct Drone build URL.
This commit is contained in:
autonomic-bot
2026-05-31 14:00:02 +00:00
parent 0df57c6d0c
commit 6910b197d0

View File

@ -42,8 +42,11 @@ while [ "$(date +%s)" -lt "$deadline" ]; do
| python3 -c "import json,sys
try: d=json.load(sys.stdin)
except Exception: d={}
# Look for cc-ci/testme context first (most specific); fall back to first status URL
sts=d.get('statuses') or []
print(d.get('state','') or 'none', (sts[0].get('target_url') if sts else '') or '')" 2>/dev/null || echo "none ")
ctx_url=next((s.get('target_url','') for s in sts if s.get('context')=='cc-ci/testme'), '')
url=ctx_url or (sts[0].get('target_url','') if sts else '')
print(d.get('state','') or 'none', url or '')" 2>/dev/null || echo "none ")
case "$state" in
success) echo "VERDICT=GREEN"; echo "BUILD=${url}"; exit 0;;
failure|error) echo "VERDICT=RED"; echo "BUILD=${url}"; exit 2;;