Skip to content

Commit 0513e84

Browse files
authored
Minor GCP doc updates (#120)
1 parent 0da5c76 commit 0513e84

2 files changed

Lines changed: 27 additions & 11 deletions

File tree

cleancloud/doctor/gcp.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,10 @@ def run_gcp_doctor(project_id: Optional[str] = None) -> None:
262262
info(" - Service Account: set GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json")
263263
info("")
264264
info("IAM permissions required (assign to your service account or user):")
265-
info(" Built-in role: roles/viewer (at project scope, covers all Compute + Monitoring)")
266-
info(" Built-in role: roles/cloudsql.viewer (for Cloud SQL idle detection)")
265+
info(" roles/compute.viewer — all Compute Engine rules")
266+
info(" roles/cloudsql.viewer — Cloud SQL idle rule")
267+
info(" roles/monitoring.viewer — Cloud SQL connection metrics")
268+
info(" roles/browser — project listing (required for --all-projects)")
267269
info("")
268270
info(" Or the individual permissions CleanCloud uses:")
269271
info(" compute.disks.list")
@@ -530,17 +532,20 @@ def run_gcp_doctor(project_id: Optional[str] = None) -> None:
530532
info(" roles/compute.viewer — all Compute Engine rules")
531533
info(" roles/cloudsql.viewer — Cloud SQL idle rule")
532534
info(" roles/monitoring.viewer — Cloud SQL connection metrics")
533-
info(" roles/browser — project listing (or specify --project)")
534-
info("")
535-
info(" Or assign: roles/viewer (covers Compute + Monitoring at project scope)")
535+
info(" roles/browser — project listing (required for --all-projects)")
536536
info("")
537537
sa_hint = "<your-service-account>@<project>.iam.gserviceaccount.com"
538-
info(" Example fix command:")
539-
info(
540-
f" gcloud projects add-iam-policy-binding {probe_project_id or '<project-id>'} \\"
541-
)
542-
info(f' --member="serviceAccount:{sa_hint}" \\')
543-
info(' --role="roles/viewer"')
538+
project_hint = probe_project_id or "<project-id>"
539+
info(" Example fix commands:")
540+
for role in [
541+
"roles/compute.viewer",
542+
"roles/cloudsql.viewer",
543+
"roles/monitoring.viewer",
544+
"roles/browser",
545+
]:
546+
info(f" gcloud projects add-iam-policy-binding {project_hint} \\")
547+
info(f' --member="serviceAccount:{sa_hint}" \\')
548+
info(f' --role="{role}"')
544549

545550
# Rule coverage map — translates permissions into rule-level status
546551
info("")

docs/ci.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,17 @@ jobs:
274274

275275
> The credentials file is short-lived and mounted read-only — no long-lived keys are exposed. The `test -f` guard catches a silent auth failure before Docker attempts the mount.
276276

277+
**Local development with gcloud ADC:**
278+
279+
`gcloud auth application-default login` writes credentials to your host filesystem. Docker can't see the host filesystem by default — mount the file explicitly:
280+
281+
```bash
282+
docker run --rm \
283+
-e GOOGLE_APPLICATION_CREDENTIALS=/tmp/adc.json \
284+
-v ~/.config/gcloud/application_default_credentials.json:/tmp/adc.json:ro \
285+
getcleancloud/cleancloud scan --provider gcp --project YOUR_PROJECT_ID
286+
```
287+
277288
### Pinning to a specific version
278289

279290
```yaml

0 commit comments

Comments
 (0)