|
15 | 15 | # limitations under the License. |
16 | 16 |
|
17 | 17 | # Universal Direct Workload Identity Federation Setup Script for GitHub Actions |
18 | | -# This script sets up Google Cloud Direct Workload Identity Federation for any GitHub repository |
19 | | -# to work with the google-github-actions/auth action. |
| 18 | +# The original script sets up Google Cloud Direct Workload Identity Federation for |
| 19 | +# any GitHub repositorty to work with the google-github-actions/auth action. |
20 | 20 | # |
21 | | -# Uses Direct WIF (preferred): No intermediate service accounts, direct authentication to GCP resources. |
| 21 | +# It has been modified for Gemini CLI, which requires a special WIF setup |
| 22 | +# setup through a Service Account. |
| 23 | + |
22 | 24 |
|
23 | 25 | set -e |
24 | 26 |
|
@@ -221,9 +223,7 @@ required_apis=( |
221 | 223 | ) |
222 | 224 | # Separately enable the internal-only Cloud Code API, ignoring errors |
223 | 225 | # for public users who may not have access. |
224 | | -gcloud services enable "cloudcode-pa.googleapis.com" --project="${GOOGLE_CLOUD_PROJECT}" || true |
225 | 226 | gcloud services enable "${required_apis[@]}" --project="${GOOGLE_CLOUD_PROJECT}" |
226 | | -gcloud services enable "cloudcode-pa.googleapis.com" --project="${GOOGLE_CLOUD_PROJECT}" || true |
227 | 227 | print_success "APIs enabled successfully." |
228 | 228 |
|
229 | 229 | # Step 2: Create Workload Identity Pool |
@@ -319,38 +319,10 @@ else |
319 | 319 | fi |
320 | 320 |
|
321 | 321 | # Step 4: Grant required permissions to the Workload Identity Pool |
322 | | -print_header "Step 4: Granting required permissions to Workload Identity Pool" |
| 322 | +print_header "(Skipped) Step 4: Granting required permissions to Workload Identity Pool" |
323 | 323 | PRINCIPAL_SET="principalSet://iam.googleapis.com/${WIF_POOL_ID}/attribute.repository/${GITHUB_REPO}" |
324 | 324 |
|
325 | | -print_info "Granting required permissions directly to the Workload Identity Pool..." |
326 | | - |
327 | | -# Observability permissions |
328 | | -print_info "Granting logging permissions..." |
329 | | -gcloud projects add-iam-policy-binding "${GOOGLE_CLOUD_PROJECT}" \ |
330 | | - --role="roles/logging.logWriter" \ |
331 | | - --member="${PRINCIPAL_SET}" \ |
332 | | - --condition=None |
333 | | - |
334 | | -print_info "Granting monitoring permissions..." |
335 | | -gcloud projects add-iam-policy-binding "${GOOGLE_CLOUD_PROJECT}" \ |
336 | | - --role="roles/monitoring.metricWriter" \ |
337 | | - --member="${PRINCIPAL_SET}" \ |
338 | | - --condition=None |
339 | | - |
340 | | -print_info "Granting tracing permissions..." |
341 | | -gcloud projects add-iam-policy-binding "${GOOGLE_CLOUD_PROJECT}" \ |
342 | | - --role="roles/cloudtrace.agent" \ |
343 | | - --member="${PRINCIPAL_SET}" \ |
344 | | - --condition=None |
345 | | - |
346 | | -# Model inference permissions |
347 | | -print_info "Granting vertex permissions..." |
348 | | -gcloud projects add-iam-policy-binding "${GOOGLE_CLOUD_PROJECT}" \ |
349 | | - --role="roles/aiplatform.user" \ |
350 | | - --member="${PRINCIPAL_SET}" \ |
351 | | - --condition=None |
352 | | - |
353 | | -print_success "Required permissions granted to Workload Identity Pool" |
| 325 | +print_info "(Skipped) Granting required permissions directly to the Workload Identity Pool..." |
354 | 326 |
|
355 | 327 | # Step 5: Create and Configure Service Account for Gemini CLI |
356 | 328 | print_header "Step 5: Create and Configure Service Account for Gemini CLI" |
|
0 commit comments