fix(CI): smoke-test bruker gcloud run services proxy for å omgå identity token-problem
This commit is contained in:
parent
ff0c847fec
commit
74f47ac331
|
|
@ -58,7 +58,7 @@ steps:
|
||||||
- '--quiet'
|
- '--quiet'
|
||||||
|
|
||||||
# Steg 5: Smoke test — verifiser at agenten svarer etter deploy
|
# 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'
|
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
|
||||||
id: smoke-test
|
id: smoke-test
|
||||||
waitFor: ['deploy']
|
waitFor: ['deploy']
|
||||||
|
|
@ -67,11 +67,10 @@ steps:
|
||||||
- '-c'
|
- '-c'
|
||||||
- |
|
- |
|
||||||
echo "=== Smoke Test ==="
|
echo "=== Smoke Test ==="
|
||||||
TOKEN=$$(curl -sf \
|
TOKEN=$$(gcloud auth print-identity-token \
|
||||||
-H "Metadata-Flavor: Google" \
|
--impersonate-service-account=${_AGENT_SA} \
|
||||||
"http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token" \
|
--audiences="https://${_CLOUD_RUN_URL}") \
|
||||||
| python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])") \
|
|| { echo "❌ Kunne ikke hente identity token"; exit 1; }
|
||||||
|| { echo "❌ Kunne ikke hente access token"; exit 1; }
|
|
||||||
|
|
||||||
RESPONSE=$$(curl -sf \
|
RESPONSE=$$(curl -sf \
|
||||||
-H "Authorization: Bearer $$TOKEN" \
|
-H "Authorization: Bearer $$TOKEN" \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user