CI/CD on Google Cloud: Cloud Build, Artifact Registry, Cloud Deploy and Safe Release Strategies

Google Cloud Platform Architect 55 min min read Updated: Nov 17, 2026 Intermediate
CI/CD on Google Cloud: Cloud Build, Artifact Registry, Cloud Deploy and Safe Release Strategies
Intermediate Topic 1 of 3

CI and CD

TermMeaning
Continuous IntegrationMerge code often. Each change is built and tested automatically
Continuous DeliveryEvery good build can be released, usually with approval
Continuous DeploymentEvery good build is released automatically
text Git push ─► Cloud Build (test, build image, scan) ─► Artifact Registry ─► Cloud Deploy dev → staging → (approval) → production (GKE / Cloud Run), with canary and rollback

Artifact Registry

  • Private storage for container images and language packages (npm, Maven, Python, apt, yum) and Helm charts
  • Regional or multi-regional repositories with IAM, vulnerability scanning and cleanup policies
  • Replaces the older Container Registry
bash gcloud artifacts repositories create apps --repository-format=docker --location=asia-south1 --description="App images" gcloud auth configure-docker asia-south1-docker.pkg.dev docker tag shop:1.0 asia-south1-docker.pkg.dev/my-proj/apps/shop:1.0 docker push asia-south1-docker.pkg.dev/my-proj/apps/shop:1.0

Cloud Build

  • Serverless build service. Each step runs in a container. Triggers: push to GitHub, GitLab or Cloud Source style repos, pull request, tag, manual, Pub/Sub
  • Use a dedicated service account with minimum permissions
  • Private pools for builds inside your VPC
  • Store results (images, test reports) in Artifact Registry and Cloud Storage
yaml steps: - name: python:3.12 entrypoint: bash args: ['-c', 'pip install -r requirements.txt && pytest -q'] - name: gcr.io/cloud-builders/docker args: ['build', '-t', 'asia-south1-docker.pkg.dev/$PROJECT_ID/apps/shop:$SHORT_SHA', '.'] - name: gcr.io/cloud-builders/docker args: ['push', 'asia-south1-docker.pkg.dev/$PROJECT_ID/apps/shop:$SHORT_SHA'] - name: gcr.io/google.com/cloudsdktool/cloud-sdk entrypoint: gcloud args: ['run', 'deploy', 'shop', '--image', 'asia-south1-docker.pkg.dev/$PROJECT_ID/apps/shop:$SHORT_SHA', '--region', 'asia-south1'] options: {logging: CLOUD_LOGGING_ONLY}
bash gcloud builds submit --config=cloudbuild.yaml . gcloud builds triggers create github --name=shop-main --repo-name=shop --repo-owner=acme --branch-pattern='^main$' --build-config=cloudbuild.yaml

Cloud Deploy

  • Managed continuous delivery to GKE, Cloud Run and Anthos clusters
  • A delivery pipeline has ordered targets (dev, staging, prod) with approvals, verification, automatic rollback and canary strategies
  • Gives an audit trail of what ran where
StrategyHow it worksRisk
RollingReplace instances graduallyMixed versions during rollout
Blue/greenRun new version beside old, switch traffic, keep old for rollbackDouble capacity during switch
CanarySend a small percent (5, 25, 50, 100) to the new version and watch metricsNeeds good monitoring
RecreateStop old, start newDowntime
Feature flagsShip code turned off, enable for some usersFlag management

Supply Chain Security

  1. Use trusted base images and pin versions
  2. Scan images in Artifact Registry (Artifact Analysis) and fail the build on critical issues
  3. Sign images and use Binary Authorization to allow only signed images into GKE or Cloud Run
  4. Use SLSA provenance from Cloud Build
  5. Never put secrets in images or repos: use Secret Manager
  6. Use Workload Identity Federation for GitHub Actions instead of key files

Testing in the Pipeline

  • Unit tests, integration tests (emulators for Firestore, Pub/Sub, Spanner), security scans, load tests before production, smoke tests after deploy
  • Fail fast: run quick tests first

Practice

  1. Create an Artifact Registry repo and push an image
  2. Write a cloudbuild.yaml that tests, builds and deploys to Cloud Run
  3. Create a trigger on your main branch
  4. Explain when you would choose canary vs blue/green

Conclusion

Cloud Build tests and builds, Artifact Registry stores artifacts, and Cloud Deploy promotes releases with approvals and canary or blue/green strategies. Secure the supply chain with scanning, signing and Binary Authorization.

Quick Summary: CI CD; Artifact Registry; Cloud Build; Cloud Deploy; supply chain; testing.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators