File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 40
40
export PROJECT_ID=$GOOGLE_CLOUD_PROJECT
41
41
fi
42
42
43
+ # Determine region dynamically from gcloud config (must be set by user)
44
+ REGION=$( gcloud config get-value compute/region 2> /dev/null)
45
+ if [ -z " $REGION " ]; then
46
+ echo " No default compute/region set. Please set one with:"
47
+ echo " gcloud config set compute/region REGION"
48
+ exit 1
49
+ fi
50
+
43
51
echo Running prerequisites on project $PROJECT_ID
44
52
BUCKET_NAME=gs://$PROJECT_ID -tf-state
45
53
if gsutil ls $BUCKET_NAME ; then
@@ -133,15 +141,14 @@ add_secret_accessor "$LOOKER_AGENT_CONFIG" "$COMPUTEMEMBER"
133
141
add_secret_accessor " $LOOKER_AGENT_CONFIG " " $CUSTOMSAMEMBER "
134
142
# ---------------------------------------------------
135
143
136
-
137
144
echo " Creating artifact registry repository"
138
- if gcloud artifacts repositories describe cloud-run-source-deploy --location=us-central1 --project=" $PROJECT_ID " & > /dev/null; then
145
+ if gcloud artifacts repositories describe cloud-run-source-deploy --location=" $REGION " --project=" $PROJECT_ID " & > /dev/null; then
139
146
echo " Repository 'cloud-run-source-deploy' already exists."
140
147
else
141
148
echo " Creating Artifact Registry repository 'cloud-run-source-deploy'..."
142
- gcloud artifacts repositories create cloud-run-source-deploy --repository-format=docker --location=us-central1 --async
149
+ gcloud artifacts repositories create cloud-run-source-deploy --repository-format=docker --location=" $REGION " --async
143
150
fi
144
151
145
- gcloud builds submit --config ./build/cloudbuild.yaml --region us-central1
152
+ gcloud builds submit --config ./build/cloudbuild.yaml --region " $REGION "
146
153
147
154
echo Script completed successfully!
You can’t perform that action at this time.
0 commit comments