agentleFS
ai-enhanced-engineerai-enhanced-engineer/aiee-skills/skills/gcp-cicd-patterns/SKILL.md

gcp-cicd-patterns

Skill4 starsChanged 5 months agoMITView on GitHub

Cloud-native CI/CD patterns for GCP using Cloud Build, Cloud Deploy, and GitOps. Use for pipeline design, deployment strategies (canary, blue-green), artifact management, or automating deployments to Cloud Run and GKE.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Environments-as-code: - All deployments described declaratively in Git

    line 47
  2. Very specific:

    PR Comment Workflows: use pull-requests: write, invoke skills directly rather than embedding prompt text, avoid path filters that miss …

    line 97

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

GCP CI/CD Patterns

Cloud-native continuous integration and delivery patterns for Google Cloud Platform, emphasizing GitOps methodology and managed services.

Core Services

ServicePurposeUse When
Cloud BuildServerless CIBuilding, testing, scanning artifacts
Cloud DeployManaged CDProgressive rollouts to Cloud Run/GKE
Artifact RegistryContainer storageStoring and promoting images
Cloud RunServerless computeStateless HTTP workloads

Note: Cloud Deployment Manager deprecated March 2026. Use Terraform or Infrastructure Manager.

GitOps Methodology

Two-Repository Pattern

app-repo/           # Application code
├── src/
├── Dockerfile
└── cloudbuild.yaml  # CI: build, test, push image

env-repo/           # Environment configuration
├── staging/
│   └── deployment.yaml
├── production/
│   └── deployment.yaml
└── cloudbuild.yaml  # CD: apply manifests

Flow: Code push → Build image → Push to registry → Update env-repo → Deploy to target

Key Principles

  1. Environments-as-code - All deployments described declaratively in Git
  2. Build once, deploy many - Same artifact promoted through environments
  3. Git is source of truth - Rollback = revert commit
  4. Automated reconciliation - Drift detection and correction

Deployment Strategies

StrategyRiskUse Case
RollingMediumStandard updates, gradual replacement
CanaryLowProduction validation with real traffic
Blue-GreenLowNear-zero downtime, instant rollback

Pipeline Stages

Recommended CI/CD pipeline structure:

  1. Source - Trigger on push/PR
  2. Build - Compile, create artifacts
  3. Unit Test - Fast feedback
  4. Static Analysis - Security scanning (Trivy, tfsec)
  5. Publish - Push to Artifact Registry
  6. Deploy Staging - Automatic
  7. Integration Test - Validate in staging
  8. Deploy Production - Manual approval or canary

Critical Rules

  1. Promote the same image from staging to production - rebuilding for prod re-introduces toolchain drift the staging tests already caught
  2. Scan before deploy - deploying an unscanned image lets critical CVEs reach production silently
  3. Tag immutably - SHA-based tags; latest makes rollback ambiguous and image-promotion non-auditable
  4. Secrets in Secret Manager - secrets pasted into cloudbuild.yaml end up in the build log and the repo history
  5. Approval gates - automated production deploys remove the last human check on a bad image
  6. Match SA keys to permissions - See Service Account section below

GitHub Actions Service Account Configuration

Secret names like GCP_SA_KEY don't indicate which SA they contain — assuming the wrong identity burns hours on phantom permission errors. Debug first:

- name: Debug GCP Service Account
  run: echo "${{ secrets.GCP_SA_KEY }}" | jq -r '.client_email'

Each workflow needs the SA scoped for its job (Terraform, Liquibase, and Cloud Build each require different roles). See reference.md § GitHub Actions Service Account Configuration for the permission table, anti-pattern YAML, and "Could Not Find Default Credentials" checklist.

GitHub Actions Patterns

Three common CI integration patterns — see reference.md § GitHub Actions Patterns for full YAML and trade-off detail:

  • PR Comment Workflows: use pull-requests: write, invoke skills directly rather than embedding prompt text, avoid path filters that miss Dockerfiles.
  • Batch Database Jobs: Cloud SQL Proxy sidecar on ubuntu-latest is simpler than Cloud Run Jobs for scheduled nightly/weekly work.
  • EAS Builds (Expo/React Native): push-only trigger, pin eas-cli, use --no-wait; see examples.md for the workflow YAML.

Angular CI: Budget Enforcement Gap

Angular style budgets are enforced only in production builds — ng serve silently ignores them. Run ng build --configuration=production in CI; use two-tier thresholds (warning 4 kB, error 6 kB). See reference.md § Angular CI for the budget config snippet.

See reference.md for detailed configurations and examples.md for Cloud Build templates.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.