Is it possible to access Google Cloud Build variables such as the PROJECT_ID
as part of a gcp-build
script in a Google App Engine Standard Node.js custom build step?
In my testing, the gcp-build script is able to get an application default credential and from what I recall, the auth library has multiple different approaches that it falls back through to get the credential (eg. environment variables, well-known file, metadata service, etc).
I checked the environment variables via process.env
and didn't see any variables relevant to the question. I skipped the well-known file approach and tried the metadata service and was able to get the project ID from the metadata service, but I'm curious what the recommended approach is or if there is a better way to access variables like the project ID.