Google Cloud · CI/CD for GKE
From Git Commit to GKE: Follow One Release All the Way to Production
Trace a release from reviewed commit to running image, then prove the customer journey still works.
Start with a release you can trace
Harborlane, the illustrative company in this guide, needs to fix duplicate booking emails. Maya merges commit a83f29c. Before production, the team needs four answers: which image contains the fix, which checks passed, who can release it, and what to restore if bookings fail.
Use this walkthrough to build a release evidence record. Commands assume an existing, approved pipeline, targets and permissions; experiment in a learning environment.
Give each stage a clear job
Read the diagram
A reviewed commit is built and tested into an image identified by its digest. Promote that same image through development and production, verifying the result and obtaining approval before the production release.
Git records the change. Cloud Build tests and packages it. Artifact Registry stores the image. Cloud Deploy manages releases and target-specific rollouts. GKE runs the selected image. Application checks establish whether the release works.
Review the change and its release inputs
The pull request explains the duplicate-email bug and includes a regression test. Version the build definition, manifests and delivery configuration alongside the application. For multiple services, record which source paths build each deployable unit.
Keep feature-branch checks separate from production authority. Untrusted pull requests must not receive release credentials. Review pipeline configuration as privileged code.
Prove that CI can stop a bad release
Run required unit, integration and dependency checks, then build and scan the candidate. Required failures must return a failing exit status and block release. Pin and maintain dependencies and builder images; record build inputs.
Break the regression test in an approved learning pipeline. Confirm it prevents an eligible release, then restore it. Name who triages scan findings and approves time-limited exceptions.
Record the full image digest
A tag helps people recognise an image; a digest identifies its content. Inspect the successful build and repository, replacing all capitalised placeholders:
gcloud builds describe BUILD_ID \
--project=PROJECT_ID \
--region=BUILD_REGION \
--format="yaml(id,status,results.images,serviceAccount)"
gcloud artifacts docker images list \
REGION-docker.pkg.dev/PROJECT_ID/apps/booking-api \
--project=PROJECT_ID --include-tagsUse the build’s actual location for BUILD_REGION: its supported region, or global if created there. Second-generation repository resources require a supported region. Build, registry and delivery locations can differ; see the command reference.
Confirm the build result and registry digest agree. Record the complete REGION-docker.pkg.dev/PROJECT_ID/apps/booking-api@sha256:DIGEST reference with the test results. Promote that artifact rather than rebuilding it per environment.
Separate build, delivery and runtime identities
The build identity needs build, publish and logging access. The delivery execution identity needs access to its target. The application needs its own identity for required APIs and data.
For triggered Cloud Build jobs, inspect the service account configured on the trigger and its required logging setup. For GKE workloads, use supported Workload Identity Federation patterns instead of embedding downloaded keys. Test that deployment succeeds while unrelated customer-data access is denied.
Create the release from that artifact
Cloud Deploy uses Skaffold to render, deploy and optionally verify the release. With your pipeline already configured, bind the manifest’s image placeholder to the recorded digest:
gcloud deploy releases create booking-a83f29c \
--project=PROJECT_ID \
--region=REGION \
--delivery-pipeline=booking-api \
--images=booking-api=REGION-docker.pkg.dev/PROJECT_ID/apps/booking-api@sha256:DIGESTThis command changes the delivery system. By default, creating the release also starts a rollout to the first target. Use the intended pipeline and a placeholder matching your manifests; inspect the rendered result before promotion.
Check startup, traffic and shutdown
Set resource requests and scaling limits against observed demand and dependency capacity. Kubernetes startup probes protect initialisation time, readiness determines traffic eligibility through Services, and liveness can trigger restarts. A temporary dependency failure should not automatically become a restart loop.
In development, test slow startup, dependency failure and rolling updates. Check that new instances receive traffic only when ready and in-flight work can finish during shutdown. A disruption budget constrains voluntary disruption; it cannot prevent every outage.
Verify the booking before promotion
Run a synthetic booking using approved test data. Confirm exactly one notification, record the release identity and clean up. Configure Cloud Deploy’s verification task and the pipeline stage that enables it; a non-zero verification exit fails the rollout.
Investigate unreachable endpoints and scoped test credentials rather than bypassing a failed check. Where production approval is required, configure it on the target and review the artifact, verification result and recovery plan.
Rehearse recovery before production
If booking errors rise, stop promotion and follow the incident procedure. Cloud Deploy rollback creates a new rollout from an earlier release. Keep its image and deployment inputs available and explicitly select the version to restore.
Deploying old code does not reverse database changes, payments or emails. Use compatible migrations and rehearse data recovery separately. Repeat the customer-facing check after recovery.
Keep one release record
| Item | Record |
|---|---|
| Source | Full commit SHA, reviewed change and regression test |
| Artifact | Build result and complete image digest |
| Delivery | Release, target rollout IDs and approval |
| Outcome | Booking check, error rate and latency comparison |
| Recovery | Owner, selected prior release and data dependencies |
Link failed attempts and operational evidence so responders can explain retries and changes.
Fix the weakest hand-off first
Start with the gap you can demonstrate: laptop-only builds, movable production tags, overpowered deployment identities or untested recovery. Add the missing control and prove it works before expanding automation.
Run a short release review
- Trace a non-production release from full commit SHA to running digest.
- Review build, delivery and runtime permissions.
- Confirm an approved failing check stops progress.
- Restore a prior version and repeat the booking test.
Give each gap an owner. Continue with the production readiness review for the wider service.
Current documentation and next steps
Use the exact product and configuration requirements in these references.
- Cloud Deploy concepts, targets, releases and promotion
- Deploy an app to GKE with Cloud Deploy
- Cloud Build user-managed service accounts and logs
- Inspect Artifact Registry image versions and tags
- Workload Identity Federation for GKE
- Configure post-deployment verification
- Roll back a Cloud Deploy target
- Kubernetes probe behaviour and configuration
