fix(preflight): never force interactive ADC login on VM; use metadata service-account
Powered by Jason, Crafted by Vauco
This commit is contained in:
parent
77a3bd2eef
commit
60f46af69d
|
|
@ -23,13 +23,18 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 2. ADC
|
# 2. ADC (Application Default Credentials)
|
||||||
|
# På en GCE-VM leveres ADC automatisk av metadata-serveren — ALDRI tving
|
||||||
|
# interaktiv 'gcloud auth application-default login' (browser-kode henger på VM).
|
||||||
if gcloud auth application-default print-access-token >/dev/null 2>&1; then
|
if gcloud auth application-default print-access-token >/dev/null 2>&1; then
|
||||||
ok "ADC (application-default)"
|
ok "ADC (application-default)"
|
||||||
|
elif curl -s -H "Metadata-Flavor: Google" \
|
||||||
|
"http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token" \
|
||||||
|
>/dev/null 2>&1; then
|
||||||
|
ok "ADC (VM metadata service-account)"
|
||||||
else
|
else
|
||||||
warn "ADC ikke satt — kjører: gcloud auth application-default login --no-launch-browser"
|
warn "ADC ikke tilgjengelig. På VM: sjekk at instansen har en service-account."
|
||||||
gcloud auth application-default login --no-launch-browser \
|
warn "Manuelt (kun hvis nødvendig): gcloud auth application-default login"
|
||||||
--scopes="https://www.googleapis.com/auth/cloud-platform"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 3. Prosjekt
|
# 3. Prosjekt
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user