fix(CI): smoke-test bruker access token via metadata-server direkte URL
This commit is contained in:
parent
4e12144152
commit
ff0c847fec
|
|
@ -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 gcloud auth print-identity-token (fungerer i Cloud Build 2nd gen)
|
# Bruker access token fra metadata-server (fungerer i Cloud Build 2nd gen)
|
||||||
- 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,13 +67,14 @@ steps:
|
||||||
- '-c'
|
- '-c'
|
||||||
- |
|
- |
|
||||||
echo "=== Smoke Test ==="
|
echo "=== Smoke Test ==="
|
||||||
TOKEN=$$(gcloud auth print-identity-token \
|
TOKEN=$$(curl -sf \
|
||||||
--audiences="https://${_CLOUD_RUN_URL}") \
|
-H "Metadata-Flavor: Google" \
|
||||||
|| { echo "❌ Kunne ikke hente identity token"; exit 1; }
|
"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; }
|
||||||
|
|
||||||
RESPONSE=$$(curl -sf \
|
RESPONSE=$$(curl -sf \
|
||||||
-H "Authorization: Bearer $$TOKEN" \
|
-H "Authorization: Bearer $$TOKEN" \
|
||||||
-H "x-goog-authenticated-user-email: accounts.google.com:ci-test@vauco.no" \
|
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"user_id": "ci", "session_id": "smoke-$BUILD_ID", "message": "ping"}' \
|
-d '{"user_id": "ci", "session_id": "smoke-$BUILD_ID", "message": "ping"}' \
|
||||||
"https://${_CLOUD_RUN_URL}/run") \
|
"https://${_CLOUD_RUN_URL}/run") \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user