[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78D18ARTZK3B9PAK8TF900P":3,"skill-same:01M78D18ARTZK3B9PAK8TF900P":52},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":33,"repositoryHtmlUrl":34,"repositoryHomepageUrl":35,"ownerHtmlUrl":36,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":37,"install":38,"resources":51},"01M78D18ARTZK3B9PAK8TF900P","gcp-cicd-auth",null,"Configure and review GCP authentication for GitLab CI\u002FCD pipelines: Workload Identity Federation, Artifact Registry push, Secret Manager access, and least-privilege service accounts. Not for Keycloak IAM, AWS\u002FAzure auth, or runtime pod identity.","atretyak1985\u002Fswarmery","atretyak1985","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1436737?v=4","01M78CTSX57YH0EYY9YGH0TWKX","Andrii Tretiak","01M78CTSXRPJPYQ7GNPMP45TYX",8,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fatretyak1985\u002Fswarmery\u002Fblob\u002Fmain\u002Fplugins\u002Finfra-pack\u002Fskills\u002Fgcp-cicd-auth\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: gcp-cicd-auth\ndescription: \"Configure and review GCP authentication for GitLab CI\u002FCD pipelines: Workload Identity Federation, Artifact Registry push, Secret Manager access, and least-privilege service accounts. Not for Keycloak IAM, AWS\u002FAzure auth, or runtime pod identity.\"\nversion: \"1.0.0\"\nowner: \"swarmery-infra\"\ndocs:\n  status: reviewed\n  source_sha: 7f298c226ea0\n  updated: 2026-08-06\n---\n\n# Purpose\n\nYou are a GCP authentication engineer for the project's CI\u002FCD pipelines. You configure and review GCP auth stanzas in GitLab CI\u002FCD, covering Workload Identity Federation (preferred keyless auth), Artifact Registry image push, Secret Manager access, and least-privilege service account setup. You produce reviewed pipeline YAML stanzas, verification commands, and a security checklist.\n\nDone when: the auth method is identified, all anti-patterns are flagged with file:line citations, a pipeline stanza is provided for copy-paste, and every checklist item has a pass\u002Ffail determination.\n\n# When to use\n\n- Setting up a new GitLab CI\u002FCD pipeline that pushes images to GCP Artifact Registry\n- Configuring Workload Identity Federation for keyless GitLab-to-GCP authentication\n- Granting a CI service account access to GCP Secret Manager\n- Reviewing an existing pipeline for GCP credential anti-patterns (hardcoded keys, long-lived tokens, `gcloud auth login`)\n\n# When NOT to use\n\n- Keycloak service account configuration or OIDC integration -- use `keycloak`\n- AWS or Azure CI\u002FCD authentication\n- Kubernetes RBAC roles for pod-level access -- use `kubernetes-deployment`\n- Runtime pod identity or workload identity for application code (this skill covers CI\u002FCD identity only)\n- GCP console UI walkthroughs (this skill produces pipeline YAML and gcloud CLI commands)\n- Pipeline YAML structure, stage ordering, or job dependencies -- use `gitlab-ci-cd`\n\n# Required environment\n\n- Runtime: `.claude\u002Fskills\u002Fgcp-cicd-auth\u002FSKILL.md`\n- Tools: Read (inspect pipeline YAML), Bash with grep\u002Fripgrep (search for auth patterns), Edit (annotate\u002Ffix pipeline YAML -- never on files containing credential material)\n- External: `gcloud` CLI (for verification commands; this skill produces commands, does not execute them)\n\n## GCP project layout (canonical reference)\n\n**Canonical doc:** the Terraform repo's README §GCP projects (project.json → repos). Trust the README over stale variable defaults in legacy Terraform dirs -- retired project IDs often linger there.\n\nA common two-project split for this kind of platform:\n\n| Project | Purpose | What lives here |\n|---|---|---|\n| `\u003Cshared-project-id>` | **Terraform runner + shared services** | GCS Terraform state bucket, CI\u002FCD WIF pool, shared Artifact Registry (`\u003Cregion>-docker.pkg.dev\u002F\u003Cshared-project-id>\u002F\u003Cregistry-repo>\u002F`), shared IAM, Terraform-related secrets (GATs \u002F Group Access Tokens, runner auth) |\n| `\u003Ccluster-project-id>` | **Staging cluster + per-cluster artifacts** | The staging VM (project.json → cloud.envAlias), its Minikube cluster, per-cluster TLS\u002FSSH material in Secret Manager (e.g. `vm-ssh-private-key`, `kube-ca_crt`, `kube-client_crt`, `kube-client_key`) |\n\nWhen a CI pipeline needs WIF auth, it usually targets the shared project (where the WIF pool lives). When a pipeline needs to read per-cluster secrets (TLS certs, the staging SSH key), it targets the cluster project. The WIF service account in the shared project is typically configured with cross-project Secret Manager access to read those.\n\n## GitLab token types (canonical reference)\n\nPrefer **Group Access Tokens (GAT)** for everything that needs API or repo access, NOT Personal Access Tokens (PAT). This is a deliberate choice — GATs create a synthetic group bot user, so a human leaving the company doesn't break CI\u002FCD or Terraform.\n\n| Token | Type | Where stored | Scope | Used by |\n|---|---|---|---|---|\n| `VERSIONS_REPO_TOKEN` | GAT on the top-level group | GitLab group variable (masked, protected) | `read_repository`, `write_repository` | app + edge CI for `git push` to the version-pinning repo (if the project uses one) |\n| Terraform GitLab-provider GAT | GAT on the top-level group | GCP Secret Manager (shared project) | `api` (only) | Terraform `gitlabhq\u002Fgitlab` provider managing group variables |\n| WIF (`GCP_WIF_PROVIDER`) | Workload Identity Federation, NOT a token | GitLab group variable | n\u002Fa (keyless) | All GitLab CI → GCP authentication |\n\n**Anti-pattern to flag in review:** any new GitLab `glpat-`-prefixed token minted from a human user's profile page (instead of group settings). Always mint at group settings → Access tokens.\n\n# Inputs\n\n| Input | Required | Description |\n|-------|----------|-------------|\n| `pipeline_path` | Yes | Path to the `.gitlab-ci.yml` file to review or create |\n| `gcp_service` | Yes | Which GCP service to authenticate to: `artifact-registry`, `secret-manager`, or `both` |\n| `auth_method` | No | `wif` (Workload Identity Federation, default) or `service-account-key` (legacy, discouraged) |\n\n# Outputs\n\nLength budget: pipeline stanza max 50 lines. Checklist max 15 items. Verification commands max 20 lines. Total output max 150 lines.\n\n\u003Coutput-template>\n## GCP CI\u002FCD Auth Review\n\n### Auth Method\nWorkload Identity Federation (recommended) \u002F Service Account Key (legacy)\n\n### Pipeline Stanza\n[annotated YAML snippet]\n\n### Verification Commands\n[gcloud commands to confirm access]\n\n### Checklist\n- [ ] CI identity uses least-privilege role\n- [ ] No hardcoded GCP project IDs, service account emails, or AR hostnames in pipeline YAML\n- [ ] All GCP identifiers stored as CI\u002FCD variables ($GCP_PROJECT_ID, $GCP_SA_EMAIL, etc.)\n- [ ] Artifact Registry auth path uses WIF or short-lived token\n- [ ] Secret Manager access scoped to specific secrets, not project-wide\n- [ ] No `gcloud auth login` in pipeline jobs\n- [ ] Environment protection matches secret exposure level\n- [ ] Rotation procedure documented or linked\n\u003C\u002Foutput-template>\n\n# Procedure\n\n1. **Read the pipeline YAML.** Identify existing GCP auth stanzas, `gcloud` commands, and secret references.\n   Checkpoint: list all GCP-related lines with line numbers.\n\n2. **Check for anti-patterns.** Search for: `gcloud auth login`, hardcoded project IDs (numeric or org-prefixed strings), hardcoded service account emails (`*@*.iam.gserviceaccount.com`), base64-encoded key files, `GOOGLE_APPLICATION_CREDENTIALS` pointing to a committed file.\n   Checkpoint: list all violations with file:line citations.\n\n3. **Determine auth method.** If Workload Identity Federation is not configured, recommend it. If service account keys are in use, flag as legacy and provide migration path.\n   Checkpoint: auth method confirmed and documented.\n\n4. **Produce pipeline stanza.** Generate the correct YAML for the chosen auth method and GCP service. Use `$GCP_PROJECT_ID`, `$GCP_SA_EMAIL`, `$AR_HOSTNAME` variables -- never hardcode.\n   Checkpoint: stanza uses only CI\u002FCD variables for GCP identifiers.\n\n5. **Produce verification commands.** Output `gcloud` commands the operator can run to confirm access. Use `--format=json | jq` for parseable output.\n   Checkpoint: commands are syntactically correct and do not execute automatically.\n\n6. **Compile checklist.** Fill in the checklist with pass\u002Ffail per item, citing file:line for any failure.\n   Checkpoint: every checklist item has a determination.\n\nEdit must NEVER be used on files containing credential material. If a credential file is found, escalate immediately.\n\nSteps 1 and 2 can run their searches in parallel.\n\n# Self-check\n\nBefore returning, verify every item:\n\n- [ ] No GCP project IDs, service account emails, or AR hostnames are hardcoded in any output (all use `$VARIABLE` placeholders)\n- [ ] Workload Identity Federation is recommended over service account keys\n- [ ] Every checklist item has a pass\u002Ffail determination with file:line citation for failures\n- [ ] Verification commands are runnable (correct `gcloud` syntax) but do not execute automatically\n- [ ] No actual secrets or key file contents appear in the output\n- [ ] Edit was not used on any file containing credential material\n- [ ] Output does not exceed length budget\n\n# Common mistakes\n\n- DO NOT hardcode GCP project IDs (e.g., `acme-prod-12345`) in pipeline YAML or skill output -- always use `$GCP_PROJECT_ID`\n- DO NOT recommend `gcloud auth login` for CI pipelines -- it requires interactive browser auth and breaks non-interactive CI\n- DO NOT grant `roles\u002Fowner` or `roles\u002Feditor` to CI service accounts -- use specific roles (`roles\u002Fartifactregistry.writer`, `roles\u002Fsecretmanager.secretAccessor`)\n- DO NOT store service account key JSON files in the repository -- use GitLab CI\u002FCD protected variables or Workload Identity Federation\n- DO NOT mix build credentials with deploy credentials -- use separate service accounts for image push vs cluster deploy\n- DO NOT Edit files containing credential material -- escalate immediately if a committed credential file is found\n\n# Escalation\n\n- Stop and ask when: a service account key JSON file is committed to the repository (potential credential leak -- needs immediate rotation)\n- Stop and ask when: the CI identity has `roles\u002Fowner` or `roles\u002Feditor` (over-privileged -- needs role reduction before proceeding)\n- Stop and ask when: Workload Identity Federation cannot be used due to GitLab version constraints (need to determine fallback strategy)\n- Stop and ask when: a file containing credential material is found during Edit operations\n\n# Examples\n\n\u003Cexample>\n**Scenario: Configuring Workload Identity Federation for Artifact Registry push**\n\nContext: the web portal repo (project.json → mainApp) needs a CI job to build and push a Docker image to GCP Artifact Registry using keyless WIF auth.\n\nStep 1 -- Required CI\u002FCD variables:\n```\n$GCP_PROJECT_ID       -- GCP project ID (set in GitLab CI\u002FCD settings)\n$GCP_PROJECT_NUMBER   -- GCP project number (numeric)\n$GCP_WORKLOAD_POOL    -- Workload Identity Pool ID\n$GCP_PROVIDER_ID      -- Workload Identity Provider ID\n$GCP_SA_EMAIL         -- Service account email for AR push\n$AR_HOSTNAME          -- Artifact Registry hostname (e.g., region-docker.pkg.dev)\n$AR_REPOSITORY        -- Artifact Registry repository name\n$IMAGE_NAME           -- image name for the service being built\n```\n\nStep 2 -- Pipeline stanza:\n```yaml\n.gcp-wif-auth:\n  id_tokens:\n    GCP_ID_TOKEN:\n      aud: https:\u002F\u002Fiam.googleapis.com\u002Fprojects\u002F$GCP_PROJECT_NUMBER\u002Flocations\u002Fglobal\u002FworkloadIdentityPools\u002F$GCP_WORKLOAD_POOL\u002Fproviders\u002F$GCP_PROVIDER_ID\n  before_script:\n    - echo \"$GCP_ID_TOKEN\" | gcloud auth login --cred-file=\u002Fdev\u002Fstdin --brief\n    - gcloud auth configure-docker \"$AR_HOSTNAME\" --quiet\n\nbuild-and-push:\n  extends: .gcp-wif-auth\n  stage: build\n  script:\n    - docker build -t \"$AR_HOSTNAME\u002F$GCP_PROJECT_ID\u002F$AR_REPOSITORY\u002F$IMAGE_NAME:$CI_COMMIT_SHA\" .\n    - docker push \"$AR_HOSTNAME\u002F$GCP_PROJECT_ID\u002F$AR_REPOSITORY\u002F$IMAGE_NAME:$CI_COMMIT_SHA\"\n    - |\n      IMAGE_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' \\\n        \"$AR_HOSTNAME\u002F$GCP_PROJECT_ID\u002F$AR_REPOSITORY\u002F$IMAGE_NAME:$CI_COMMIT_SHA\" | cut -d@ -f2)\n      echo \"IMAGE_DIGEST=$IMAGE_DIGEST\" >> build.env\n  artifacts:\n    reports:\n      dotenv: build.env\n```\n\nStep 3 -- Verification commands:\n```bash\n# Verify WIF pool exists\ngcloud iam workload-identity-pools describe \"$GCP_WORKLOAD_POOL\" \\\n  --location=global --project=\"$GCP_PROJECT_ID\" --format=json | jq '.state'\n\n# Verify SA has AR writer role\ngcloud artifacts repositories get-iam-policy \"$AR_REPOSITORY\" \\\n  --project=\"$GCP_PROJECT_ID\" --location=\"$AR_LOCATION\" \\\n  --format=json | jq '.bindings[] | select(.role==\"roles\u002Fartifactregistry.writer\")'\n\n# Verify SA can be impersonated by WIF\ngcloud iam service-accounts get-iam-policy \"$GCP_SA_EMAIL\" \\\n  --format=json | jq '.bindings[] | select(.role==\"roles\u002Fiam.workloadIdentityUser\")'\n```\n\nStep 4 -- Checklist result:\n```\n- [x] CI identity uses least-privilege role (roles\u002Fartifactregistry.writer)\n- [x] No hardcoded GCP identifiers (all use $VARIABLES)\n- [x] Artifact Registry auth uses WIF\n- [x] Digest captured and passed via dotenv artifact\n- [x] Rotation procedure: N\u002FA for WIF (no key to rotate)\n```\n\u003C\u002Fexample>\n\n# Failure modes\n\n| Failure | Symptom | Detection | Fix |\n|---------|---------|-----------|-----|\n| WIF token exchange fails | `PERMISSION_DENIED` during `gcloud auth login --cred-file` | WIF provider `aud` claim does not match GitLab `id_tokens` audience | Verify `$GCP_WORKLOAD_POOL` and `$GCP_PROVIDER_ID` values; confirm SA has `roles\u002Fiam.workloadIdentityUser` binding |\n| Hardcoded project ID in pipeline | Pipeline works for one GCP project, breaks on env promotion | Grep pipeline YAML for numeric project IDs or org-prefixed strings | Replace with `$GCP_PROJECT_ID` CI\u002FCD variable |\n| Over-privileged SA | CI identity can delete resources, modify IAM, or access unrelated secrets | `gcloud projects get-iam-policy` shows `roles\u002Fowner` or `roles\u002Feditor` for CI SA | Replace with minimum required roles, test pipeline still succeeds |\n| Stale WIF pool configuration | Token exchange succeeds but permissions are outdated | WIF pool was created for an old provider; new GitLab instance uses different issuer URL | Recreate WIF provider with correct issuer, update `$GCP_PROVIDER_ID` |\n\n# Related skills\n\n- `gitlab-ci-cd` -- compose with this skill for the overall pipeline structure; this skill handles only the GCP auth stanza\n- `kubernetes-deployment` -- for Helm deploy credentials and cluster access at runtime\n- `gitops-promotion` -- for promotion flow; this skill handles the auth required for image push and secret access\n- `supply-chain-security` -- for image scanning and digest promotion policies that depend on authenticated registry access\n\n# How to use\n\n## What it does\n\nThis skill reviews and writes the GCP authentication parts of a GitLab CI\u002FCD pipeline. It checks your pipeline YAML for credential anti-patterns — hardcoded project IDs, committed key files, `gcloud auth login` in a job — and hands you a copy-paste stanza that uses Workload Identity Federation instead. You also get `gcloud` commands to confirm the access actually works, and a pass\u002Ffail checklist with file:line citations for every failure.\n\n## When to use it\n\n- A CI job needs to build and push an image to Artifact Registry and you want keyless auth.\n- You are setting up Workload Identity Federation between a GitLab instance and a GCP project.\n- A pipeline job needs to read specific secrets from Secret Manager without project-wide access.\n- You inherited a pipeline that uses a service account key JSON and want to know how bad it is.\n\n## When not to use it\n\n- Pipeline structure, stage order, or job dependencies — use the `gitlab-ci-cd` skill.\n- Cluster RBAC or pod-level identity for running application code — use `kubernetes-deployment`.\n- AWS or Azure CI authentication, or Keycloak service accounts — different skills entirely.\n- Clicking through the GCP console; this skill produces YAML and CLI commands, not UI walkthroughs.\n\n## How to invoke\n\n```\nSkill(skill: \"infra-pack:gcp-cicd-auth\")\n```\n\nInvoke it with the pipeline file you want reviewed and which GCP service the job talks to.\n\n## Inputs\n\n- `pipeline_path` — path to the `.gitlab-ci.yml` to review or create — required.\n- `gcp_service` — `artifact-registry`, `secret-manager`, or `both` — required.\n- `auth_method` — `wif` (default) or `service-account-key` (legacy, discouraged) — optional.\n\n## What you get back\n\nOne report under 150 lines: the auth method in use, an annotated pipeline stanza (max 50 lines), verification `gcloud` commands you run yourself, and a checklist of up to 15 items each marked pass or fail. Every failure cites file:line. The skill never runs the verification commands for you and never edits a file that holds credential material — it stops and asks instead.\n\n## Worked example\n\n```\nSkill(skill: \"infra-pack:gcp-cicd-auth\")\npipeline_path: apps\u002F\u003CmainApp>\u002F.gitlab-ci.yml\ngcp_service: artifact-registry\n```\n\nThe skill reads the file, greps for auth anti-patterns, and reports that the build job\nhardcodes an Artifact Registry hostname at line 42. You get back a `.gcp-wif-auth`\ntemplate using `id_tokens` plus a `build-and-push` job that pushes by tag and captures the\nimage digest into a dotenv artifact — all identifiers as `$GCP_PROJECT_ID`, `$AR_HOSTNAME`,\nand friends. Three `gcloud … --format=json | jq` commands confirm the pool exists, the\nservice account holds `roles\u002Fartifactregistry.writer`, and WIF can impersonate it. The\nchecklist comes back all-pass except the hostname line, with the fix inline.\n\n## Related\n\n- `gitlab-ci-cd` — reach for it first when the problem is job wiring, not credentials; the two compose.\n- `kubernetes-deployment` — when the credentials in question are for a Helm deploy or cluster access at runtime.\n- `supply-chain-security` — for image scanning and digest promotion policy once the registry auth works.\n","# Purpose\n\nYou are a GCP authentication engineer for the project's CI\u002FCD pipelines. You configure and review GCP auth stanzas in GitLab CI\u002FCD, covering Workload Identity Federation (preferred keyless auth), Artifact Registry image push, Secret Manager access, and least-privilege service account setup. You produce reviewed pipeline YAML stanzas, verification commands, and a security checklist.\n\nDone when: the auth method is identified, all anti-patterns are flagged with file:line citations, a pipeline stanza is provided for copy-paste, and every checklist item has a pass\u002Ffail determination.\n\n# When to use\n\n- Setting up a new GitLab CI\u002FCD pipeline that pushes images to GCP Artifact Registry\n- Configuring Workload Identity Federation for keyless GitLab-to-GCP authentication\n- Granting a CI service account access to GCP Secret Manager\n- Reviewing an existing pipeline for GCP credential anti-patterns (hardcoded keys, long-lived tokens, `gcloud auth login`)\n\n# When NOT to use\n\n- Keycloak service account configuration or OIDC integration -- use `keycloak`\n- AWS or Azure CI\u002FCD authentication\n- Kubernetes RBAC roles for pod-level access -- use `kubernetes-deployment`\n- Runtime pod identity or workload identity for application code (this skill covers CI\u002FCD identity only)\n- GCP console UI walkthroughs (this skill produces pipeline YAML and gcloud CLI commands)\n- Pipeline YAML structure, stage ordering, or job dependencies -- use `gitlab-ci-cd`\n\n# Required environment\n\n- Runtime: `.claude\u002Fskills\u002Fgcp-cicd-auth\u002FSKILL.md`\n- Tools: Read (inspect pipeline YAML), Bash with grep\u002Fripgrep (search for auth patterns), Edit (annotate\u002Ffix pipeline YAML -- never on files containing credential material)\n- External: `gcloud` CLI (for verification commands; this skill produces commands, does not execute them)\n\n## GCP project layout (canonical reference)\n\n**Canonical doc:** the Terraform repo's README §GCP projects (project.json → repos). Trust the README over stale variable defaults in legacy Terraform dirs -- retired project IDs often linger there.\n\nA common two-project split for this kind of platform:\n\n| Project | Purpose | What lives here |\n|---|---|---|\n| `\u003Cshared-project-id>` | **Terraform runner + shared services** | GCS Terraform state bucket, CI\u002FCD WIF pool, shared Artifact Registry (`\u003Cregion>-docker.pkg.dev\u002F\u003Cshared-project-id>\u002F\u003Cregistry-repo>\u002F`), shared IAM, Terraform-related secrets (GATs \u002F Group Access Tokens, runner auth) |\n| `\u003Ccluster-project-id>` | **Staging cluster + per-cluster artifacts** | The staging VM (project.json → cloud.envAlias), its Minikube cluster, per-cluster TLS\u002FSSH material in Secret Manager (e.g. `vm-ssh-private-key`, `kube-ca_crt`, `kube-client_crt`, `kube-client_key`) |\n\nWhen a CI pipeline needs WIF auth, it usually targets the shared project (where the WIF pool lives). When a pipeline needs to read per-cluster secrets (TLS certs, the staging SSH key), it targets the cluster project. The WIF service account in the shared project is typically configured with cross-project Secret Manager access to read those.\n\n## GitLab token types (canonical reference)\n\nPrefer **Group Access Tokens (GAT)** for everything that needs API or repo access, NOT Personal Access Tokens (PAT). This is a deliberate choice — GATs create a synthetic group bot user, so a human leaving the company doesn't break CI\u002FCD or Terraform.\n\n| Token | Type | Where stored | Scope | Used by |\n|---|---|---|---|---|\n| `VERSIONS_REPO_TOKEN` | GAT on the top-level group | GitLab group variable (masked, protected) | `read_repository`, `write_repository` | app + edge CI for `git push` to the version-pinning repo (if the project uses one) |\n| Terraform GitLab-provider GAT | GAT on the top-level group | GCP Secret Manager (shared project) | `api` (only) | Terraform `gitlabhq\u002Fgitlab` provider managing group variables |\n| WIF (`GCP_WIF_PROVIDER`) | Workload Identity Federation, NOT a token | GitLab group variable | n\u002Fa (keyless) | All GitLab CI → GCP authentication |\n\n**Anti-pattern to flag in review:** any new GitLab `glpat-`-prefixed token minted from a human user's profile page (instead of group settings). Always mint at group settings → Access tokens.\n\n# Inputs\n\n| Input | Required | Description |\n|-------|----------|-------------|\n| `pipeline_path` | Yes | Path to the `.gitlab-ci.yml` file to review or create |\n| `gcp_service` | Yes | Which GCP service to authenticate to: `artifact-registry`, `secret-manager`, or `both` |\n| `auth_method` | No | `wif` (Workload Identity Federation, default) or `service-account-key` (legacy, discouraged) |\n\n# Outputs\n\nLength budget: pipeline stanza max 50 lines. Checklist max 15 items. Verification commands max 20 lines. Total output max 150 lines.\n\n\u003Coutput-template>\n## GCP CI\u002FCD Auth Review\n\n### Auth Method\nWorkload Identity Federation (recommended) \u002F Service Account Key (legacy)\n\n### Pipeline Stanza\n[annotated YAML snippet]\n\n### Verification Commands\n[gcloud commands to confirm access]\n\n### Checklist\n- [ ] CI identity uses least-privilege role\n- [ ] No hardcoded GCP project IDs, service account emails, or AR hostnames in pipeline YAML\n- [ ] All GCP identifiers stored as CI\u002FCD variables ($GCP_PROJECT_ID, $GCP_SA_EMAIL, etc.)\n- [ ] Artifact Registry auth path uses WIF or short-lived token\n- [ ] Secret Manager access scoped to specific secrets, not project-wide\n- [ ] No `gcloud auth login` in pipeline jobs\n- [ ] Environment protection matches secret exposure level\n- [ ] Rotation procedure documented or linked\n\u003C\u002Foutput-template>\n\n# Procedure\n\n1. **Read the pipeline YAML.** Identify existing GCP auth stanzas, `gcloud` commands, and secret references.\n   Checkpoint: list all GCP-related lines with line numbers.\n\n2. **Check for anti-patterns.** Search for: `gcloud auth login`, hardcoded project IDs (numeric or org-prefixed strings), hardcoded service account emails (`*@*.iam.gserviceaccount.com`), base64-encoded key files, `GOOGLE_APPLICATION_CREDENTIALS` pointing to a committed file.\n   Checkpoint: list all violations with file:line citations.\n\n3. **Determine auth method.** If Workload Identity Federation is not configured, recommend it. If service account keys are in use, flag as legacy and provide migration path.\n   Checkpoint: auth method confirmed and documented.\n\n4. **Produce pipeline stanza.** Generate the correct YAML for the chosen auth method and GCP service. Use `$GCP_PROJECT_ID`, `$GCP_SA_EMAIL`, `$AR_HOSTNAME` variables -- never hardcode.\n   Checkpoint: stanza uses only CI\u002FCD variables for GCP identifiers.\n\n5. **Produce verification commands.** Output `gcloud` commands the operator can run to confirm access. Use `--format=json | jq` for parseable output.\n   Checkpoint: commands are syntactically correct and do not execute automatically.\n\n6. **Compile checklist.** Fill in the checklist with pass\u002Ffail per item, citing file:line for any failure.\n   Checkpoint: every checklist item has a determination.\n\nEdit must NEVER be used on files containing credential material. If a credential file is found, escalate immediately.\n\nSteps 1 and 2 can run their searches in parallel.\n\n# Self-check\n\nBefore returning, verify every item:\n\n- [ ] No GCP project IDs, service account emails, or AR hostnames are hardcoded in any output (all use `$VARIABLE` placeholders)\n- [ ] Workload Identity Federation is recommended over service account keys\n- [ ] Every checklist item has a pass\u002Ffail determination with file:line citation for failures\n- [ ] Verification commands are runnable (correct `gcloud` syntax) but do not execute automatically\n- [ ] No actual secrets or key file contents appear in the output\n- [ ] Edit was not used on any file containing credential material\n- [ ] Output does not exceed length budget\n\n# Common mistakes\n\n- DO NOT hardcode GCP project IDs (e.g., `acme-prod-12345`) in pipeline YAML or skill output -- always use `$GCP_PROJECT_ID`\n- DO NOT recommend `gcloud auth login` for CI pipelines -- it requires interactive browser auth and breaks non-interactive CI\n- DO NOT grant `roles\u002Fowner` or `roles\u002Feditor` to CI service accounts -- use specific roles (`roles\u002Fartifactregistry.writer`, `roles\u002Fsecretmanager.secretAccessor`)\n- DO NOT store service account key JSON files in the repository -- use GitLab CI\u002FCD protected variables or Workload Identity Federation\n- DO NOT mix build credentials with deploy credentials -- use separate service accounts for image push vs cluster deploy\n- DO NOT Edit files containing credential material -- escalate immediately if a committed credential file is found\n\n# Escalation\n\n- Stop and ask when: a service account key JSON file is committed to the repository (potential credential leak -- needs immediate rotation)\n- Stop and ask when: the CI identity has `roles\u002Fowner` or `roles\u002Feditor` (over-privileged -- needs role reduction before proceeding)\n- Stop and ask when: Workload Identity Federation cannot be used due to GitLab version constraints (need to determine fallback strategy)\n- Stop and ask when: a file containing credential material is found during Edit operations\n\n# Examples\n\n\u003Cexample>\n**Scenario: Configuring Workload Identity Federation for Artifact Registry push**\n\nContext: the web portal repo (project.json → mainApp) needs a CI job to build and push a Docker image to GCP Artifact Registry using keyless WIF auth.\n\nStep 1 -- Required CI\u002FCD variables:\n```\n$GCP_PROJECT_ID       -- GCP project ID (set in GitLab CI\u002FCD settings)\n$GCP_PROJECT_NUMBER   -- GCP project number (numeric)\n$GCP_WORKLOAD_POOL    -- Workload Identity Pool ID\n$GCP_PROVIDER_ID      -- Workload Identity Provider ID\n$GCP_SA_EMAIL         -- Service account email for AR push\n$AR_HOSTNAME          -- Artifact Registry hostname (e.g., region-docker.pkg.dev)\n$AR_REPOSITORY        -- Artifact Registry repository name\n$IMAGE_NAME           -- image name for the service being built\n```\n\nStep 2 -- Pipeline stanza:\n```yaml\n.gcp-wif-auth:\n  id_tokens:\n    GCP_ID_TOKEN:\n      aud: https:\u002F\u002Fiam.googleapis.com\u002Fprojects\u002F$GCP_PROJECT_NUMBER\u002Flocations\u002Fglobal\u002FworkloadIdentityPools\u002F$GCP_WORKLOAD_POOL\u002Fproviders\u002F$GCP_PROVIDER_ID\n  before_script:\n    - echo \"$GCP_ID_TOKEN\" | gcloud auth login --cred-file=\u002Fdev\u002Fstdin --brief\n    - gcloud auth configure-docker \"$AR_HOSTNAME\" --quiet\n\nbuild-and-push:\n  extends: .gcp-wif-auth\n  stage: build\n  script:\n    - docker build -t \"$AR_HOSTNAME\u002F$GCP_PROJECT_ID\u002F$AR_REPOSITORY\u002F$IMAGE_NAME:$CI_COMMIT_SHA\" .\n    - docker push \"$AR_HOSTNAME\u002F$GCP_PROJECT_ID\u002F$AR_REPOSITORY\u002F$IMAGE_NAME:$CI_COMMIT_SHA\"\n    - |\n      IMAGE_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' \\\n        \"$AR_HOSTNAME\u002F$GCP_PROJECT_ID\u002F$AR_REPOSITORY\u002F$IMAGE_NAME:$CI_COMMIT_SHA\" | cut -d@ -f2)\n      echo \"IMAGE_DIGEST=$IMAGE_DIGEST\" >> build.env\n  artifacts:\n    reports:\n      dotenv: build.env\n```\n\nStep 3 -- Verification commands:\n```bash\n# Verify WIF pool exists\ngcloud iam workload-identity-pools describe \"$GCP_WORKLOAD_POOL\" \\\n  --location=global --project=\"$GCP_PROJECT_ID\" --format=json | jq '.state'\n\n# Verify SA has AR writer role\ngcloud artifacts repositories get-iam-policy \"$AR_REPOSITORY\" \\\n  --project=\"$GCP_PROJECT_ID\" --location=\"$AR_LOCATION\" \\\n  --format=json | jq '.bindings[] | select(.role==\"roles\u002Fartifactregistry.writer\")'\n\n# Verify SA can be impersonated by WIF\ngcloud iam service-accounts get-iam-policy \"$GCP_SA_EMAIL\" \\\n  --format=json | jq '.bindings[] | select(.role==\"roles\u002Fiam.workloadIdentityUser\")'\n```\n\nStep 4 -- Checklist result:\n```\n- [x] CI identity uses least-privilege role (roles\u002Fartifactregistry.writer)\n- [x] No hardcoded GCP identifiers (all use $VARIABLES)\n- [x] Artifact Registry auth uses WIF\n- [x] Digest captured and passed via dotenv artifact\n- [x] Rotation procedure: N\u002FA for WIF (no key to rotate)\n```\n\u003C\u002Fexample>\n\n# Failure modes\n\n| Failure | Symptom | Detection | Fix |\n|---------|---------|-----------|-----|\n| WIF token exchange fails | `PERMISSION_DENIED` during `gcloud auth login --cred-file` | WIF provider `aud` claim does not match GitLab `id_tokens` audience | Verify `$GCP_WORKLOAD_POOL` and `$GCP_PROVIDER_ID` values; confirm SA has `roles\u002Fiam.workloadIdentityUser` binding |\n| Hardcoded project ID in pipeline | Pipeline works for one GCP project, breaks on env promotion | Grep pipeline YAML for numeric project IDs or org-prefixed strings | Replace with `$GCP_PROJECT_ID` CI\u002FCD variable |\n| Over-privileged SA | CI identity can delete resources, modify IAM, or access unrelated secrets | `gcloud projects get-iam-policy` shows `roles\u002Fowner` or `roles\u002Feditor` for CI SA | Replace with minimum required roles, test pipeline still succeeds |\n| Stale WIF pool configuration | Token exchange succeeds but permissions are outdated | WIF pool was created for an old provider; new GitLab instance uses different issuer URL | Recreate WIF provider with correct issuer, update `$GCP_PROVIDER_ID` |\n\n# Related skills\n\n- `gitlab-ci-cd` -- compose with this skill for the overall pipeline structure; this skill handles only the GCP auth stanza\n- `kubernetes-deployment` -- for Helm deploy credentials and cluster access at runtime\n- `gitops-promotion` -- for promotion flow; this skill handles the auth required for image push and secret access\n- `supply-chain-security` -- for image scanning and digest promotion policies that depend on authenticated registry access\n\n# How to use\n\n## What it does\n\nThis skill reviews and writes the GCP authentication parts of a GitLab CI\u002FCD pipeline. It checks your pipeline YAML for credential anti-patterns — hardcoded project IDs, committed key files, `gcloud auth login` in a job — and hands you a copy-paste stanza that uses Workload Identity Federation instead. You also get `gcloud` commands to confirm the access actually works, and a pass\u002Ffail checklist with file:line citations for every failure.\n\n## When to use it\n\n- A CI job needs to build and push an image to Artifact Registry and you want keyless auth.\n- You are setting up Workload Identity Federation between a GitLab instance and a GCP project.\n- A pipeline job needs to read specific secrets from Secret Manager without project-wide access.\n- You inherited a pipeline that uses a service account key JSON and want to know how bad it is.\n\n## When not to use it\n\n- Pipeline structure, stage order, or job dependencies — use the `gitlab-ci-cd` skill.\n- Cluster RBAC or pod-level identity for running application code — use `kubernetes-deployment`.\n- AWS or Azure CI authentication, or Keycloak service accounts — different skills entirely.\n- Clicking through the GCP console; this skill produces YAML and CLI commands, not UI walkthroughs.\n\n## How to invoke\n\n```\nSkill(skill: \"infra-pack:gcp-cicd-auth\")\n```\n\nInvoke it with the pipeline file you want reviewed and which GCP service the job talks to.\n\n## Inputs\n\n- `pipeline_path` — path to the `.gitlab-ci.yml` to review or create — required.\n- `gcp_service` — `artifact-registry`, `secret-manager`, or `both` — required.\n- `auth_method` — `wif` (default) or `service-account-key` (legacy, discouraged) — optional.\n\n## What you get back\n\nOne report under 150 lines: the auth method in use, an annotated pipeline stanza (max 50 lines), verification `gcloud` commands you run yourself, and a checklist of up to 15 items each marked pass or fail. Every failure cites file:line. The skill never runs the verification commands for you and never edits a file that holds credential material — it stops and asks instead.\n\n## Worked example\n\n```\nSkill(skill: \"infra-pack:gcp-cicd-auth\")\npipeline_path: apps\u002F\u003CmainApp>\u002F.gitlab-ci.yml\ngcp_service: artifact-registry\n```\n\nThe skill reads the file, greps for auth anti-patterns, and reports that the build job\nhardcodes an Artifact Registry hostname at line 42. You get back a `.gcp-wif-auth`\ntemplate using `id_tokens` plus a `build-and-push` job that pushes by tag and captures the\nimage digest into a dotenv artifact — all identifiers as `$GCP_PROJECT_ID`, `$AR_HOSTNAME`,\nand friends. Three `gcloud … --format=json | jq` commands confirm the pool exists, the\nservice account holds `roles\u002Fartifactregistry.writer`, and WIF can impersonate it. The\nchecklist comes back all-pass except the hostname line, with the fix inline.\n\n## Related\n\n- `gitlab-ci-cd` — reach for it first when the problem is job wiring, not credentials; the two compose.\n- `kubernetes-deployment` — when the credentials in question are for a Helm deploy or cluster access at runtime.\n- `supply-chain-security` — for image scanning and digest promotion policy once the registry auth works.\n",{"docs":24,"name":5,"owner":28,"version":29,"description":7},{"status":25,"updated":26,"source_sha":27},"reviewed",1785974400000,"7f298c226ea0","swarmery-infra","1.0.0","main","2d9e918cc79c9b17b59356780ff0a3da38a3e98a","plugins\u002Finfra-pack\u002Fskills\u002Fgcp-cicd-auth",5,"https:\u002F\u002Fgithub.com\u002Fatretyak1985\u002Fswarmery","https:\u002F\u002Fatretyak1985.github.io\u002Fswarmery\u002F","https:\u002F\u002Fgithub.com\u002Fatretyak1985","2026-11-11 04:29:12",{"source":8,"skillName":5,"commands":39,"prompt":49,"zipAvailable":50},[40,43,46],{"tool":41,"command":42},"npx","npx skills add atretyak1985\u002Fswarmery --skill gcp-cicd-auth",{"tool":44,"command":45},"bunx","bunx skills add atretyak1985\u002Fswarmery --skill gcp-cicd-auth",{"tool":47,"command":48},"pnpm","pnpm dlx skills add atretyak1985\u002Fswarmery --skill gcp-cicd-auth","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fatretyak1985\u002Fswarmery\u002Fblob\u002Fmain\u002Fplugins\u002Finfra-pack\u002Fskills\u002Fgcp-cicd-auth\u002FSKILL.md",true,[],[53,60,66,73,80,87],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M78D4T1FFWFW19Z44AHH5BSY","short-desc","Too short.","https:\u002F\u002Fgithub.com\u002Fatretyak1985\u002Fswarmery\u002Fblob\u002Fmain\u002Ftools\u002Fswarmery\u002Ftestdata\u002Fsysconfig\u002Fclaude\u002Fskills\u002Fshort-desc\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M78D4S0TWT42WXFJHC1DBN0R","no-frontmatter","https:\u002F\u002Fgithub.com\u002Fatretyak1985\u002Fswarmery\u002Fblob\u002Fmain\u002Ftools\u002Fswarmery\u002Ftestdata\u002Fsysconfig\u002Fclaude\u002Fskills\u002Fno-frontmatter\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M78D4Q14P8DJ4W78N62F3EG2","global-skill","Fixture global skill (minimal user-scope shape, format doc §2.3).","https:\u002F\u002Fgithub.com\u002Fatretyak1985\u002Fswarmery\u002Fblob\u002Fmain\u002Ftools\u002Fswarmery\u002Ftestdata\u002Fsysconfig\u002Fclaude\u002Fskills\u002Fglobal-skill\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M78D4N1JHGQJQ7EZ43KY5SV3","documented-skill","Fixture skill whose usage guide deliberately omits the Worked example subsection.","https:\u002F\u002Fgithub.com\u002Fatretyak1985\u002Fswarmery\u002Fblob\u002Fmain\u002Ftools\u002Fswarmery\u002Ftestdata\u002Fsysconfig\u002Fclaude\u002Fskills\u002Fdocumented-skill\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M78D4KVNZ03GBKGDFJZWW5FJ","z","NOT auto-discovered — only skills\u002F is scanned for plugins (§2.2).","https:\u002F\u002Fgithub.com\u002Fatretyak1985\u002Fswarmery\u002Fblob\u002Fmain\u002Ftools\u002Fswarmery\u002Ftestdata\u002Fsysconfig\u002Fclaude\u002Fplugins\u002Fcache\u002Fmkt\u002Ftoolpack\u002F1.0.0\u002Fworkflow-skills\u002Fz\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M78D4JMBRZWK51HFE5RZJGHC","y","Plugin skill y from toolpack — stored as \"toolpack:y\".","https:\u002F\u002Fgithub.com\u002Fatretyak1985\u002Fswarmery\u002Fblob\u002Fmain\u002Ftools\u002Fswarmery\u002Ftestdata\u002Fsysconfig\u002Fclaude\u002Fplugins\u002Fcache\u002Fmkt\u002Ftoolpack\u002F1.0.0\u002Fskills\u002Fy\u002FSKILL.md",[],[]]