Prepare and test your skills

Prepare and test your skills

Secure continuous deployment and containerized artifact management is the practice of building, versioning, scanning, and promoting immutable container images through isolated environments with least-privilege identities. Artifact Registry (opens in a new tab) centralizes storage and versioning of those artifacts, Cloud Build creates them with verifiable provenance, Artifact Analysis scans them for vulnerabilities, and Cloud Deploy with Binary Authorization promotes only verified images. Data flows from the source repository to Cloud Build and then to Artifact Registry, and the deployment stage pulls only the promoted digest from Artifact Registry to the target environment.
Artifact Registry is a universal package manager for build artifacts and dependencies that gives centralized visibility and control over the software supply chain. Pipeline code, container images, and pipeline components stored in Artifact Registry carry versions that integrate with builds and staged delivery, so the same immutable digest moves from development to test to production and supports rollback to a known safe version. Cloud Deploy (opens in a new tab) pulls only the promoted digest for delivery, which guarantees that test and production run exactly the same bits.
Artifact Registry isolates trusted code from external code through repository types and security controls. Remote repositories cache artifacts from preset external sources to reduce download time, improve availability, and enable vulnerability scanning when scanning is enabled:
Artifact protection also depends on access control, Virtual Private Cloud (VPC) Service Controls service perimeters, and organizational policies applied to the registry.
Vulnerability scanning and provenance for container images establish whether an image is safe to deploy and who built it. Artifact Analysis (opens in a new tab) scans new images when they are uploaded to Artifact Registry by extracting system package information, then continuously monitors scanned metadata as new vulnerability information arrives, updating metadata, creating new occurrences, and deleting occurrences that are no longer valid. Scanning runs as on-demand or automated scanning for base container images and language packages, and Artifact Analysis also generates a software bill of materials (SBOM) and uploads Vulnerability Exploitability eXchange (VEX) statements for images in Artifact Registry.
Build integrity and deployment enforcement depend on Cloud Build and Binary Authorization working together. Cloud Build runs builds on Google Cloud infrastructure in isolated and ephemeral build environments and supports Supply-chain Levels for Software Artifacts (SLSA) Level 3 builds for container images with authenticated and non-falsifiable build provenance. Build provenance is verifiable metadata that includes digests of built images, input source locations, toolchain, build steps, and build duration, and security insights expose the SLSA level, vulnerabilities, and provenance in dashboards. Binary Authorization attaches attestations, which are configurable signatures, to container images and checks them at deployment time to Google Kubernetes Engine (GKE), GKE Enterprise, and Cloud Run.
Binary Authorization enforces that only trusted code runs by verifying promotion criteria before the target platform admits the image:
Exam tip: Artifact Analysis detects vulnerabilities in Artifact Registry images, while Binary Authorization blocks deployment unless required attestations for builder identity, vulnerability policy, and environment promotion are present.
Least-privilege Identity and Access Management (IAM) for deployment pipelines means each stage uses its own service account with only the permissions that stage requires. Where possible, use unique credentials for each environment, effectively for each project, and limit access to resources in that project. The pipeline scope must stay small by granting access to individual resources instead of the project level, avoiding cross-project access, and splitting a multi-environment pipeline into individually secured stages so a compromised stage cannot damage all data and applications.
Separation of build, management, and runtime identities prevents over-granting of data and control-plane access. The artifact service account only reads and writes deployment artifacts such as template files and Java Archive (JAR) files to Cloud Storage buckets in its own environment. The Dataflow (opens in a new tab) job-management service account only creates and manages Dataflow jobs, while the worker service account only manages Compute Engine resources during job execution and handles interaction between the Apache Beam pipeline and the Dataflow service. In production, the job-management account must not have access to data sources, sinks, or other pipeline resources that only workers need.
| Service account | Controls | Least-privilege rule |
|---|---|---|
| Artifact staging account | Cloud Storage buckets holding templates, JAR files, and container references | Grant write only to the staging bucket in its own project |
| Dataflow management account | Dataflow job creation and lifecycle operations | Grant job-management roles without data source or sink access |
Dataflow worker account, set with --serviceAccount | Compute Engine workers and pipeline input and output access | Grant only compute management plus required source and sink access |
Specify a user-managed worker service account with the --serviceAccount pipeline option for production jobs. If no worker account is specified, Dataflow falls back to the Compute Engine default service account, which usually has broader permissions than Dataflow jobs require. This fallback breaks least privilege because the default account can reach more resources than the job needs.
Secure credential retrieval during deployment means the deployment process obtains short-scoped credentials from its own service account and never reuses credentials across environments. When integration tests run with the Direct Runner, the pipeline obtains credentials through Application Default Credentials (ADC), and how ADC is configured depends on where the pipeline is running. The service account behind ADC must hold sufficient Dataflow roles for the Google Cloud resources accessed by the test, and production promotion must switch to the per-environment artifact, management, and worker accounts rather than reusing the test identity.
Confidentiality and integrity boundaries further constrain what those credentials can read, write, and reach. To reduce exfiltration risk, revoke read access to data the pipeline does not need and revoke write access to storage and network locations the pipeline does not need, even if those locations hold no confidential data. Restrict outbound connectivity by blocking internet access or limiting connections to an allow-listed set, which is especially important for pipelines that access confidential data or cryptographic key material, and place projects inside VPC Service Controls (opens in a new tab) perimeters so compromised code deployed by the pipeline cannot reach unauthorized resources and APIs.
Input authenticity and pipeline hardening protect the deployment pipeline, its configuration, its infrastructure, and all consumed inputs. Many pipelines consume third-party Docker base images, .rpm or .deb packages, and Maven, npm, or NuGet libraries that an attacker can subvert by compromising the source repository, changing the pipeline configuration to point to a different repository, or uploading similarly named or typo-squatted packages. Reduce that risk by requiring signed third-party artifacts, maintaining a curated list of trusted publisher certificates or public keys for Pretty Good Privacy (PGP) signatures on RPM and Maven packages and Authenticode signatures on NuGet packages, verifying signatures in the pipeline, and verifying hashes for infrequently changed artifacts that do not support signing. Harden the underlying CI/CD software, tools such as Terraform, kubectl, and Docker, and the operating system by sourcing tools from trusted publishers, rebuilding infrastructure from scratch regularly, and running builds on Shielded VMs, then apply static analysis, policy-as-code checks, and limits on concurrent changes before each deployment.
Automated testing and quality assurance of data pipeline code means running unit tests, integration tests, and static analysis inside Cloud Build (opens in a new tab) triggers so bad changes are blocked before deployment. A commit or pull request in Git triggers Cloud Build, which pulls source and dependencies, runs validation, and only then promotes an immutable artifact to Artifact Registry for deployment by Cloud Deploy. This validation-before-promotion pattern protects downstream consumers that depend on stable schemas and business logic.
Test layers in a pipeline define what scope is being validated before code is allowed to merge or deploy. Unit testing checks individual functions or methods in isolation, integration testing checks interactions between components or modules, and end-to-end testing simulates real-world scenarios against the application as a whole. Automated testing provides early detection of bugs before production rework and enforces standards-based, maintainable code.
The three layers form a quality gate where each layer blocks a different class of failure:
An effective strategy explicitly defines the types of tests to run, the frequency of testing, and the criteria for passing or failing a test. Cloud Build enforces the strategy as a quality gate: failed tests stop image creation, artifact promotion, and deployment to testing, staging, or production.
Static analysis and artifact validation in Cloud Build check code quality and supply-chain safety after unit tests pass and before deployment. Code development events in the development loop trigger Cloud Build, which pulls application source from version control and pulls declared dependencies such as JAR files from Artifact Registry. Cloud Build then runs the build with static analysis and unit testing, and only on success builds a container image, pushes it to Artifact Registry, and creates an image digest for traceability.
Image approval depends on automated scans that run inside the same trigger. Container Structure Tests perform command tests, file existence tests, file content tests, and metadata tests, while vulnerability scanning checks the image against a Google Cloud-maintained vulnerability database. Approved images continue in the pipeline and are signed by Binary Authorization (opens in a new tab), so only scanned and approved code can be deployed. Immutable container images ensure the same image runs across environments and is never patched in place; configuration is externalized and read at run time, so any fix requires building and redeploying a new image.
Apache Beam pipelines are Python or Java codebases executed on Dataflow, and Cloud Build validates them like application code before a template or container is published. Reusable Dataflow templates let teams deploy without rewriting Beam code, including Google-provided templates such as Pub/Sub to BigQuery with a JavaScript user-defined function parameter and Cloud Storage text to BigQuery. Custom logic is typically built with parallel transforms such as ParDo, plus Beam SQL for SQL-like processing.
Validation flows from source to artifact to execution in a fixed order that avoids costly fixes after launch. First, Cloud Build pulls the Beam codebase and dependencies on a push or pull request trigger. Then it runs static analysis and unit tests on transforms and helper functions, followed by integration tests across I/O connectors for Cloud Storage, BigQuery, Pub/Sub, and Firestore. Then it packages the approved template or container image to Artifact Registry. This order matters because Dataflow jobs are bound to their project and stateful pipeline state is costly to fix after launch; blocking invalid logic in Cloud Build avoids draining or recreating jobs later.
Validation of Managed Service for Apache Airflow (Managed Airflow), formerly Cloud Composer, uses two separate Cloud Build triggers with different purposes. The presubmit trigger runs on a pull request from a development branch to main and executes unit tests to check that the directed acyclic graph (DAG) is valid. The sync trigger runs only after approval and merge to main and copies the validated DAG into Cloud Storage in the development Managed Airflow environment.
The DAG promotion workflow preserves order and isolation between development and production, so untested code never reaches the scheduler:
This separation keeps untested DAGs out of the scheduler and keeps development and production environments identical except for promotion state. The same merge-to-branch pattern can trigger operational pipelines that pull containers from Artifact Registry (opens in a new tab), move data from source projects, transform and validate data, and train or evaluate models before registry import.
Exam tip: The presubmit Cloud Build trigger validates a DAG before merge to main, while the sync Cloud Build trigger copies the DAG to Cloud Storage only after merge; a DAG sync failure does not mean the DAG failed unit tests.
Validation of SQL schemas protects BigQuery (opens in a new tab) core tables and views that serve as the source of truth for analytics. Data flows from transactional sources such as OLTP SQL and NoSQL databases into a staging area, then into core tables that must remain complete, consistent, and schema-compliant over time. Consumers do not read core tables directly; traffic flows from core tables through an access layer of views that encapsulate business logic such as metrics, filtering, and grouping to dashboards, notebooks, operational systems, and ad-hoc users.
SQL assets divide by role, and each role needs a different check in CI because a schema error breaks every downstream consumer:
| Asset | Purpose in BigQuery | Validation in Cloud Build |
|---|---|---|
| Data definition language (DDL) | Defines schema of tables and views | Compile check and validation rules on created tables, often with Dataform |
| Data manipulation language (DML) | Manipulates data and creates tables from existing tables | Integration test on staging or cloned data for completeness and business-logic correctness |
| Data control language (DCL) | Controls permissions and access | Policy check with preference for IAM over SQL, bq tool, or REST API |
Dataform supplies the compilation and testing process that SQL otherwise lacks by validating scripts and checking predefined rules on DDL-created tables. Because schemas and view logic act as service level agreements for downstream consumers, schema mismatches or incorrect data propagate to every dashboard and application; validating DDL, DML, and access-layer views in Cloud Build before integration preserves those agreements while still allowing new datasets, sources, and table changes.
Manage Infrastructure as Code and Multi-Environment Promotion is the practice of storing desired cloud infrastructure in Git as Terraform (opens in a new tab) code and promoting it through automated Cloud Build pipelines across development, non-production, and production environments. In this GitOps model, Git branches represent environments, and pushes to those branches trigger pipeline runs that make the real infrastructure match the code. Terraform state is stored in a Cloud Storage bucket so every build shares the same consistent view of what has already been deployed.
The GitOps promotion model uses persistent Git branches named dev, non-production, and prod to represent real Google Cloud environments, often defined as separate Virtual Private Cloud (VPC) networks, folders, and projects. When Terraform code is pushed to the dev or prod branch, Cloud Build triggers and runs terraform apply to change that environment to the desired state. When code is pushed to any other branch, such as a feature branch, Cloud Build runs only terraform plan so reviewers can see proposed changes without applying them to any environment.
Promotion follows a repeatable order where changes are first merged into dev, deployed and tested in the development environment, and only then merged forward into non-production and production. Developers and operators propose changes on feature or non-protected branches and submit them through pull requests for discussion and review before merging. This sequence ensures production only receives code that has already succeeded in a lower environment with the same Terraform manifests.
Exam tip: A push to a feature branch runs terraform plan with no apply, while a merge into dev or prod runs terraform apply to that matching environment.
The layered pipeline design separates platform-wide resources from workload-specific resources and from application code. The foundation pipeline provisions organization-level foundations and creates the infrastructure pipelines, the infrastructure pipeline provisions workload projects and data infrastructure such as Compute Engine instances, databases, consumer projects, and shared VPC resources, and the application pipeline deploys workload artifacts such as container images onto infrastructure created by the infrastructure pipeline.
The foundation pipeline deploys multiple infrastructure pipelines so each business unit or data platform team can manage its own infrastructure independently. Each infrastructure pipeline runs in a dedicated project in the common folder with its own service account that has permission to deploy only to projects associated with that business unit. This creates separation of duties between the highly privileged service accounts used for the foundation pipeline and the scoped accounts used by each infrastructure pipeline.
| Pipeline | Provisioned by | Resources provisioned |
|---|---|---|
| Foundation pipeline | Bootstrap | Data platform folder and subfolders, common projects, infrastructure pipeline service account, Cloud Build trigger for infrastructure pipeline, shared VPC, VPC Service Controls perimeter |
| Infrastructure pipeline | Foundation pipeline | Consumer projects, Service Catalog service account, Cloud Build trigger for Service Catalog pipeline, artifact pipeline service account, Cloud Build trigger for artifact pipeline |
| Service Catalog pipeline | Infrastructure pipeline | Resources deployed in the Service Catalog bucket for interactive development templates |
| Artifact pipelines | Infrastructure pipeline | Containers and other codebase components used by data workloads |
The enterprise foundation stages implement the same layering, with 2-environments setting up development, non-production, and production, 3-networks-dual-svpc or 3-networks-hub-and-spoke setting up shared VPCs, 4-projects setting up folders, projects, and an infrastructure pipeline, and optional 5-app-infra deploying example workload infrastructure through that pipeline. Cloud Build (opens in a new tab) triggers in each stage run as stage-specific service accounts, so platform setup and workload deployment never share the same privileges.
Cloud Build automation for Terraform uses two build configurations to enforce validation before deployment. Each repository for a stage has two triggers, where cloudbuild-tf-plan.yaml first runs policy checks and terraform plan against the branch, and then cloudbuild-tf-apply.yaml runs terraform apply based on the outcome of that plan. If the first build fails policy or plan validation, the second build does not deploy any resources.
The blueprint builds the following controls into the foundation and infrastructure pipelines to keep infrastructure changes safe and repeatable:
GoogleCloudPlatform/policy-library, to define acceptable resource configurations.The persistent-branch strategy uses three long-lived branches for development, non-production, and production plus short-lived ephemeral feature branches that never directly deploy. A pull request process is enforced so code merged to a persistent branch has an approved review, and each pipeline repository separates submitter and approver duties between different groups. Each pipeline also pulls from its own repositories, so changing one stage repository cannot directly affect resources managed by another repository.
Promotion with this strategy follows an ordered workflow that keeps every environment repeatable and auditable:
feature/123456-org-policies.terraform plan and terraform validate to stage and verify changes.dev into prod to trigger installation in production.Choose multiple infrastructure pipelines when separate business units have the skills and need to manage infrastructure separately or require different validation policies. Choose a single infrastructure pipeline managed by one platform team when consistent validation policies and centralized control are more important than team autonomy.
Artifact Analysis scans new images when they are uploaded to Artifact Registry and continuously monitors vulnerability metadata, while Binary Authorization checks attestations at deployment time and blocks images that lack required signatures. Artifact Analysis extracts system package information, updates occurrences as new vulnerability information arrives, and generates a software bill of materials and Vulnerability Exploitability eXchange statements, while Binary Authorization verifies builder identity, vulnerability signing policy compliance, and promotion criteria from one environment to the next before Google Kubernetes Engine (GKE) or Cloud Run admits the image.
Cloud Build runs only terraform plan when code is pushed to a feature branch or any other non-environment branch so reviewers can see proposed changes without changing any environment, while a merge into the dev or prod branch runs terraform apply to change that matching environment. Promotion therefore merges changes into development for deployment and testing first and then promotes the same code forward to non-production and production so production only receives code that already succeeded in a lower environment.
The presubmit trigger runs on a pull request from a development branch to main and executes unit tests and static checks to validate the directed acyclic graph, with failure blocking the merge, while the sync trigger runs only after approval and merge to main and copies the validated DAG to Cloud Storage in the development Managed Airflow environment. This separation keeps untested DAGs out of the scheduler and keeps development and production identical except for promotion state, so a DAG sync failure does not mean the DAG failed unit tests.
Each pipeline stage should use its own service account with only the permissions that stage requires and with access limited to individual resources in its own project instead of project-level or cross-project access. The artifact staging account is granted write only to staging buckets holding templates and Java Archive files, the management account is granted only Dataflow job creation and lifecycle operations without data source or sink access, and the worker account is granted only Compute Engine management plus required source and sink access, with production jobs using a user-managed worker account because the Compute Engine default service account has broader permissions than Dataflow jobs require.
A data engineering team is designing an automated CI/CD pipeline in Google Cloud to build and deploy custom containerized data processing applications. The solution must adhere to enterprise security and deployment standards:
Which combination of actions should the team implement?
Last updated