fix(CI): smoke-test bruker gcloud run services proxy for å omgå identity token-problem

This commit is contained in:
chrischristiansen-glitch 2026-06-10 09:32:10 +02:00
parent ff0c847fec
commit 74f47ac331

View File

@ -58,7 +58,7 @@ steps:
- '--quiet'
# Steg 5: Smoke test — verifiser at agenten svarer etter deploy
# Bruker access token fra metadata-server (fungerer i Cloud Build 2nd gen)
# Bruker gcloud auth print-identity-token med impersonation (løser 2nd gen token-problem)
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
id: smoke-test
waitFor: ['deploy']
@ -67,11 +67,10 @@ steps:
- '-c'
- |
echo "=== Smoke Test ==="
TOKEN=$$(curl -sf \
-H "Metadata-Flavor: Google" \
"http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])") \
|| { echo "❌ Kunne ikke hente access token"; exit 1; }
TOKEN=$$(gcloud auth print-identity-token \
--impersonate-service-account=${_AGENT_SA} \
--audiences="https://${_CLOUD_RUN_URL}") \
|| { echo "❌ Kunne ikke hente identity token"; exit 1; }
RESPONSE=$$(curl -sf \
-H "Authorization: Bearer $$TOKEN" \