Skip to content

Commit cf91f5a

Browse files
committed
Use a cluster zone for the image building if _IMAGE_BUILD_ZONE is not provided.
1 parent f9942a9 commit cf91f5a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

node-init-image-cache/cloudbuild.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ timeout: 7200s
1616
substitutions:
1717
_PROVISION_MACHINE_TYPE: e2-standard-8
1818
_IMAGE_BUILD_REGION: "us-central1"
19-
_IMAGE_BUILD_ZONE: "us-central1-a"
19+
_IMAGE_BUILD_ZONE: "none"
2020
_EXCLUDE_REGIONS: "none"
2121
_DISK_SIZE_GB: "256"
2222
_PULL_ALL_GCR: "true"
@@ -51,13 +51,17 @@ steps:
5151
args:
5252
- -exc
5353
- |
54+
# Use a cluster zone for the image building if _IMAGE_BUILD_ZONE is not provided.
55+
BUILD_ZONE=$(awk 'NR==1 {print; exit}' zones.txt)
56+
if [[ "${_IMAGE_BUILD_ZONE}" != "none" ]]; then BUILD_ZONE=${_IMAGE_BUILD_ZONE}; fi
57+
5458
# Use the last image as a cached starting point if it's present.
5559
USE_LAST_IMAGE="true"
5660
CURR_IMAGE=$(gcloud compute images list -q --project ${PROJECT_ID} --filter='name~selkies-image-cache' --limit=1 --format='value(name)')
5761
if [[ -z "$${CURR_IMAGE}" ]]; then USE_LAST_IMAGE="false"; fi
5862
5963
cd build/selkies-image-cache
60-
gcloud builds submit --substitutions=_PROVISION_MACHINE_TYPE=${_PROVISION_MACHINE_TYPE},_PROVISION_REGION=${_IMAGE_BUILD_REGION},_PROVISION_ZONE=${_IMAGE_BUILD_ZONE},_DISK_SIZE_GB=${_DISK_SIZE_GB},_USE_LAST_IMAGE=$${USE_LAST_IMAGE},_PULL_ALL_GCR=${_PULL_ALL_GCR}
64+
gcloud builds submit --substitutions=_PROVISION_MACHINE_TYPE=${_PROVISION_MACHINE_TYPE},_PROVISION_REGION=${_IMAGE_BUILD_REGION},_PROVISION_ZONE=$${BUILD_ZONE},_DISK_SIZE_GB=${_DISK_SIZE_GB},_USE_LAST_IMAGE=$${USE_LAST_IMAGE},_PULL_ALL_GCR=${_PULL_ALL_GCR}
6165
###
6266
# Create cache disk for each zone.
6367
###

0 commit comments

Comments
 (0)