diff --git a/runscripts/container/build-runtime.sh b/runscripts/container/build-runtime.sh index 7da3c9649..608055c8b 100755 --- a/runscripts/container/build-runtime.sh +++ b/runscripts/container/build-runtime.sh @@ -36,8 +36,13 @@ if [ "$RUN_LOCAL" = true ]; then echo "=== Locally building WCM runtime Docker Image: ${RUNTIME_IMAGE} ===" docker build -f runscripts/container/runtime/Dockerfile -t "${WCM_RUNTIME}" . else - PROJECT="$(gcloud config get-value core/project)" - REGION=$(gcloud config get compute/region) + PROJECT=$(curl -H "Metadata-Flavor: Google" \ + "http://metadata.google.internal/computeMetadata/v1/project/project-id" | + cut '-d/' -f4) + REGION=$(curl -H "Metadata-Flavor: Google" \ + "http://metadata.google.internal/computeMetadata/v1/instance/zone" | + awk -F'/' '{print $NF}' | + sed 's/-[a-z]$//') TAG="${REGION}-docker.pkg.dev/${PROJECT}/vecoli/${RUNTIME_IMAGE}" echo "=== Cloud-building WCM runtime Docker Image: ${TAG} ===" echo $TAG diff --git a/runscripts/container/build-wcm.sh b/runscripts/container/build-wcm.sh index 961aba9e3..48da9133a 100755 --- a/runscripts/container/build-wcm.sh +++ b/runscripts/container/build-wcm.sh @@ -50,8 +50,10 @@ if [ "$RUN_LOCAL" = true ]; then else echo "=== Cloud-building WCM code Docker Image ${WCM_IMAGE} on ${RUNTIME_IMAGE} ===" echo "=== git hash ${GIT_HASH}, git branch ${GIT_BRANCH} ===" - PROJECT_ID=$(gcloud config get project) - REGION=$(gcloud config get compute/region) + REGION=$(curl -H "Metadata-Flavor: Google" \ + "http://metadata.google.internal/computeMetadata/v1/instance/zone" | + awk -F'/' '{print $NF}' | + sed 's/-[a-z]$//') # This needs a config file to identify the project files to upload and the # Dockerfile to run. gcloud builds submit --timeout=15m --config runscripts/container/cloud_build.json \