Prepare and test your skills
Prepare and test your skills
Deployment Strategies and Release Orchestration in Cloud Deploy (opens in a new tab) control how a release moves safely through multiple targets, such as dev, staging, and prod. A delivery pipeline defines the ordered progression of targets, a release represents a version to deploy, and a rollout executes that release into a specific target. Automation rules tied to the delivery pipeline then promote releases, advance canary phases, and repair failures without manual steps.
Automated actions in Cloud Deploy handle the movement and health of releases and rollouts after a release is created. Each automation belongs to one delivery pipeline and cannot be shared across multiple delivery pipelines. You can automate up to 250 automation rules per delivery pipeline.
An Automation is a child resource of a delivery pipeline that links one or more targets to the rules that govern promotion, advancement, or repair. An AutomationRun is an instance of that automation that is created when the automation triggers, pointing to its parent Automation plus the rollout that spawned it and related metadata. You register the Automation with gcloud deploy apply, and Cloud Deploy creates the resource that associates the delivery pipeline, targets, and rules.
kind: Automation configuration file.The two automation resources divide responsibilities as follows:
| Resource | What it stores | When it is used |
|---|---|---|
| Automation | Pointer to target or targets and the rule or rules for what to do and how | Created at registration and reused for every release in that pipeline |
| AutomationRun | Pointer to parent Automation plus rollout identity and metadata | Created each time an automation is triggered by a rollout |
A canary deployment strategy in Cloud Deploy releases a new version to a small subset of traffic first, then advances through larger percentages until the stable phase serves 100 percent. The advanceRolloutRule automates this progression by waiting for an identified source phase to become IN_PROGRESS, waiting an additional configured wait time that defines the duration of each canary phase, and then advancing the rollout to the next phase. If no sourcePhase is specified, each phase in the rollout is advanced automatically under the same wait behavior.
For Cloud Run, Cloud Deploy can manage traffic shifting automatically when runtimeConfig.cloudRun.automaticTrafficControl: true is set, so the service definition rendered from Skaffold profiles should not contain a traffic stanza. A custom-automated canary combines that automatic traffic control with a customCanaryDeployment section that defines phaseConfigs with a phaseId, traffic percentage, and Skaffold profiles, such as 10 percent warmup, 50 percent scaling, and 100 percent stable. Quality gates attach to phases through jobs where a predeploy job runs in the first canary phase, a verify job runs in each canary phase, and a postdeploy job runs in the stable phase, with each job running its configured tasks sequentially in defined order.
To run a Cloud Run canary, follow this order:
gcloud deploy rollouts advance or from the Delivery pipelines page in the console.A repairRollout rule in Cloud Deploy defines how a failed rollout is retried and when it is abandoned for rollback. After failure, Cloud Deploy waits the configured wait time and retries only the configured phases or jobs, or all phases and jobs by default, then repeats the wait-and-retry cycle until configured attempts are exhausted. During retries the rollout state stays IN_PROGRESS, while each phase shows IN_PROGRESS during a retry and FAILED after each failed attempt. If all retries fail, or if no retries are configured, Cloud Deploy creates a new rollout that rolls back the target to the most recent successful release.
Exam tip: Use promote rules to move a release between targets, but use advance rules only inside a target that uses a canary strategy to move between phases.
DevSecOps and Supply Chain Security is the practice of building security checks directly into the continuous integration and continuous deployment (CI/CD) pipeline so every code change is verified before it reaches production. A software supply chain (opens in a new tab) includes all code, dependencies, people, processes, and trusted systems used to develop, build, store, and run software. Attackers can exploit any part of this chain, from a compromised build system to an indirect open-source dependency, so Google Cloud provides modular controls for development, build, artifact storage, deployment, and policy enforcement.
Automated CI/CD pipelines in Google Cloud remove manual errors, create standard feedback loops, and make it possible to detect and fix security bugs early, fast, and reliably. Cloud Build runs builds on Google Cloud infrastructure with granular Identity and Access Management (IAM) permissions, VPC Service Controls, and isolated and ephemeral build environments. Cloud Deploy then delivers applications to a series of target environments in a defined sequence, with support for Google Kubernetes Engine (GKE), GKE Enterprise, and Cloud Run, plus one-click approvals, rollbacks, enterprise security and audit, and delivery metrics.
A secure release moves through the pipeline in order:
A left-to-right process flow showing Cloud Build to Artifact Registry with Artifact Analysis to Binary Authorization to Cloud Deploy dev to test to prod, with blocked path for missing attestations.
This order matters because each stage depends on the previous one: deployment policy cannot be enforced unless the build produced trusted provenance and scanning produced current vulnerability data.
Artifact Analysis is the service that automatically scans container images for known vulnerabilities before deployment. When a new image is uploaded to Artifact Registry, Artifact Analysis extracts information about system packages in the container for on-demand or automated scanning. After the initial scan, Artifact Analysis continuously monitors scanned image metadata in Artifact Registry against updated vulnerability sources. When new information arrives, it updates image metadata, creates new vulnerability occurrences, and deletes occurrences that are no longer valid.
Artifact Registry centralizes control by acting as a universal package manager for build artifacts and dependencies. Assured Open Source Software supplies open-source packages that Google builds in secure pipelines and regularly scans, analyzes, and tests. Remote repositories cache artifacts from external sources such as Docker Hub, Maven Central, Python Package Index (PyPI), Debian, CentOS, and user-defined sources, which improves availability and enables scanning on cached copies. Virtual repositories consolidate repositories of the same format behind a single endpoint and control search order across upstream repositories, so teams can prioritize private packages and reduce dependency confusion attacks.
Binary Authorization is the deploy-time enforcement service that ensures only trusted code runs on GKE and Cloud Run. Binary Authorization attaches configurable signatures called attestations to container images to prove that a required process was completed. At deployment time, traffic flows from the deployment request to the Binary Authorization policy engine, which checks for the required attestations and allows or denies the pod or service creation. Because enforcement happens inside the target platform boundary, a compromised pipeline or stolen credential outside that boundary cannot bypass the check to push unapproved images.
A Binary Authorization policy can require proof for different compliance gates:
VPC Service Controls adds a second boundary by restricting which resources and APIs can be reached from within specific Google Cloud projects, which limits data theft if compromised code does get deployed.
Exam tip: Artifact Analysis finds and tracks vulnerabilities in stored images, while Binary Authorization blocks deployment to GKE or Cloud Run when required attestations are missing.
Supply-chain Levels for Software Artifacts (SLSA) provenance and security insights provide the verifiable record that links source, build, and deployment for compliance. Cloud Build supports SLSA Level 3 builds for container images and generates authenticated and non-falsifiable build provenance for containerized applications. Build provenance is verifiable metadata that includes the digests of built images, input source locations, build toolchain, build steps, and build duration.
The controls divide responsibility across the pipeline lifecycle:
| Control | Acts at | What it proves or enforces |
|---|---|---|
| Cloud Build with SLSA | Build time | Build ran in a trusted, ephemeral environment at SLSA Level 3 with signed provenance |
| Artifact Analysis | Artifact Registry storage and monitoring | Image contents, SBOM, and current vulnerability status from continuous scans |
| Binary Authorization | Deployment to GKE or Cloud Run | Required attestations exist before the platform admits the image |
Pipeline integrity itself must match the integrity of the resources it manages, so teams also verify third-party base images and libraries with code signing or hashes, hold build tools and CI/CD infrastructure to the same standards, and apply policy-as-code, static analysis, and least-privilege service accounts to prevent bypass.
Automated build and artifact management is the practice of automatically producing, testing, versioning, and storing container images on every source change. On Google Cloud, Cloud Build (opens in a new tab) executes the build and test workflow, and Artifact Registry stores versioned, immutable container images for later promotion through staging to production.
The automated build workflow with Cloud Build starts when source code is modified and gives immediate feedback on each change. A Cloud Build trigger monitors the source repository, and when a commit lands on the main branch, Cloud Build rebuilds the application container, runs tests, and stores the successful result. Build artifacts flow from the source repository to Cloud Build, then from Cloud Build to a Cloud Storage bucket and to Artifact Registry, and finally from Cloud Build to Cloud Deploy for deployment to staging.
Production of each image follows an ordered sequence:
This order matters because a failing test prevents an unvalidated image from entering the registry. Shared configuration across development, staging, and production is managed through Skaffold, so the same build definition can render manifests for different environments without rebuilding the image.
Versioning and identifying artifacts means labeling every image so each pipeline execution is repeatable and traceable to its source. Without consistent labels, teams cannot tell which code produced a running container or safely roll back to a prior version. The convention separates finished releases from in-progress builds by tying each image tag to either a release number or a source commit.
| Image type | Identifier | Use when |
|---|---|---|
| Release image | Semantic versioning tag | Producing a formal release to promote across environments |
| Pre-release image | Git commit hash | Building from a main-branch commit that still needs work before release |
The release image carries a semantic version that marks a stable, promotable artifact. The pre-release image carries the commit hash from the point in the codebase that produced it, so the image links directly back to the change that triggered the build.
Base images and workload images form a two-layer containerization model where controlled foundations support application-specific images. The team designs a small set of base container images from assessed common libraries, runtime dependencies, and runtime requirements, then builds workload images starting from those bases. The set of base images stays tightly controlled and supported to avoid proliferating unsupported runtime environments.
Efficiency and suitability for containerization depend on assessing what artifacts share and what they require:
The workload image depends on its base image, so variance in the base layer multiplies across every workload. Keeping bases narrow and supported lowers patching cost and keeps test coverage focused on real differences.
Testing and validating container images means checking both the application code and the structure and safety of the image itself. Required tests include unit, functional, integration, and load or performance testing, plus structure tests that verify commands run as expected and files exist in the correct locations with correct content. To keep iteration fast, teams use rapid pipelines under 10 minutes for feature branches and full pipelines with comprehensive checks for merge requests and commits to the main branch.
Validation combines structure, compliance, and vulnerability controls. The Container Structure Tests framework performs command tests, file existence tests, file content tests, and metadata tests, while tools like InSpec run compliance test suites against runtime environments. Artifact Analysis scans images stored in Artifact Registry for known vulnerabilities, and Binary Authorization prevents vulnerable or unsigned images from deploying to clusters by requiring attestations such as passed vulnerability scan, passed quality assurance testing, or product owner sign-off.
Storing artifacts and enabling immutable promotion means keeping one unchanging image in a central registry and moving that same image through environments. Artifact Registry holds the versioned container images, ideally isolated in a dedicated Google Cloud project to separate storage and maintenance tasks, while Cloud Storage holds build artifacts and rendered manifests. The pipeline depends on this separation because builds write artifacts, deployments read them, and isolation limits blast radius between environments.
Immutable promotion works only when environment-specific configuration stays outside the image. Configuration files and secrets are injected at deploy time, so the same artifact can move from development to quality assurance to production without modification. Because the identical artifact passes through multiple testing and validation activities, the chance of production-only issues drops and rollbacks return to a known, tested image.
Exam tip: Build the container image once and promote that same immutable image across environments; rebuilding between stages can introduce untested differences.
Artifact Analysis finds and tracks vulnerabilities in stored container images, while Binary Authorization blocks deployment to Google Kubernetes Engine (GKE) and Cloud Run when required attestations are missing. Artifact Analysis scans system packages when a new image is uploaded to Artifact Registry and continuously monitors metadata against updated vulnerability sources, and Binary Authorization checks for required attestations at deploy time to allow or deny pod or service creation.
An Automation is a child resource of a delivery pipeline that stores the target or targets and the rule or rules for what to do and how, and it is created at registration and reused for every release in that pipeline. An AutomationRun is an instance of that automation that is created each time the automation is triggered by a rollout and stores a pointer to the parent Automation plus rollout identity and metadata.
Use promote rules to move a release between targets, and use advance rules only inside a target that uses a canary strategy to move between phases. A promote rule moves a release to the next target in progression or to a specific target after a successful rollout, while an advance rule moves a canary rollout from one phase to the next through increasing traffic percentages until the stable phase serves 100 percent.
An enterprise is designing an automated CI/CD pipeline on Google Cloud to deploy containerized workloads to Google Kubernetes Engine (GKE). The security team requires strict software supply chain controls and compliance enforcement across the SDLC:
Which combination of Google Cloud services and controls should the enterprise implement?
Store build credentials as encrypted environment variables in Cloud Source Repositories, sign container images with Cloud KMS directly during build, and implement Kubernetes Network Policies with GKE Pod Security Standards to restrict running unapproved images.
Store build secrets in Cloud Storage with IAM bucket policies, enable Artifact Registry vulnerability scanning, and deploy a custom mutating admission webhook in GKE to query Cloud Logging for build approval events.
Store credentials in Secret Manager, execute vulnerability scans manually through custom Compute Engine scripts, and configure Identity-Aware Proxy (IAP) with Cloud Armor at the GKE ingress to prevent unauthorized image execution.
Store sensitive build credentials in Secret Manager, enable automatic vulnerability scanning in Artifact Registry, configure the pipeline to sign images with an attestation, and enforce a Binary Authorization policy on the GKE cluster.
Last updated