Skip to content

Commit 9f12288

Browse files
fix(setup): Gracefully handle internal-only Cloud (#447)
Code API enablement Modify `setup_workload_identity.sh` to prevent script failure when enabling the internal-only `cloudcode-pa.googleapis.com` API. The API enablement command now includes `|| true`, allowing the script to continue for public users without permissions for this service. <!-- Thank you for proposing a pull request! Please note that SOME TESTS WILL LIKELY FAIL due to how GitHub exposes secrets in Pull Requests from forks. Someone from the team will review your Pull Request and respond. Please describe your change and any implementation details below. --> --------- Signed-off-by: Spencer <spencer.tang12@gmail.com> Co-authored-by: gemini-cli[bot] <218312386+gemini-cli[bot]@users.noreply.github.com>
1 parent ffc9cd2 commit 9f12288

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scripts/setup_workload_identity.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ print_header "Step 1: Enabling required Google Cloud APIs"
211211
required_apis=(
212212
"aiplatform.googleapis.com"
213213
"cloudaicompanion.googleapis.com"
214-
"cloudcode-pa.googleapis.com"
215214
"cloudresourcemanager.googleapis.com"
216215
"cloudtrace.googleapis.com"
217216
"iam.googleapis.com"
@@ -220,8 +219,11 @@ required_apis=(
220219
"monitoring.googleapis.com"
221220
"sts.googleapis.com"
222221
)
223-
222+
# Separately enable the internal-only Cloud Code API, ignoring errors
223+
# for public users who may not have access.
224+
gcloud services enable "cloudcode-pa.googleapis.com" --project="${GOOGLE_CLOUD_PROJECT}" || true
224225
gcloud services enable "${required_apis[@]}" --project="${GOOGLE_CLOUD_PROJECT}"
226+
gcloud services enable "cloudcode-pa.googleapis.com" --project="${GOOGLE_CLOUD_PROJECT}" || true
225227
print_success "APIs enabled successfully."
226228

227229
# Step 2: Create Workload Identity Pool

0 commit comments

Comments
 (0)