From 4e12144152b8e0b5b67a64b703ca2de4eb440df0 Mon Sep 17 00:00:00 2001 From: chrischristiansen-glitch Date: Wed, 10 Jun 2026 09:21:17 +0200 Subject: [PATCH] fix(CI): bytt metadata-token til gcloud auth print-identity-token i smoke-test --- cloudbuild.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 7295c40..dc15b01 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -58,7 +58,7 @@ steps: - '--quiet' # Steg 5: Smoke test — verifiser at agenten svarer etter deploy - # CI6-lærdom: identity token med riktig audience, ikke access token + # Bruker gcloud auth print-identity-token (fungerer i Cloud Build 2nd gen) - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk' id: smoke-test waitFor: ['deploy'] @@ -67,12 +67,11 @@ steps: - '-c' - | echo "=== Smoke Test ===" - TOKEN=$(curl -sf \ - -H "Metadata-Flavor: Google" \ - "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity?audience=https://${_CLOUD_RUN_URL}&format=full") \ + TOKEN=$$(gcloud auth print-identity-token \ + --audiences="https://${_CLOUD_RUN_URL}") \ || { echo "❌ Kunne ikke hente identity token"; exit 1; } - RESPONSE=$(curl -sf \ + RESPONSE=$$(curl -sf \ -H "Authorization: Bearer $$TOKEN" \ -H "x-goog-authenticated-user-email: accounts.google.com:ci-test@vauco.no" \ -H "Content-Type: application/json" \