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" \