Google PCA Practice Question: Managing and Provisioning a Solution Infrastructure
A company uses Cloud Build to deploy a Java application to Artifact Registry. They want to automatically trigger a build only when changes are pushed to the 'main' branch in their Cloud Source Repository. Which configuration should they use?
⚠ Common exam trap
PCA often tests the difference between event-driven triggers and polling mechanisms, and candidates may overcomplicate the solution by choosing custom Cloud Functions or build-step checks instead of using the native branch filter feature of Cloud Build triggers.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Create a Cloud Build trigger with an included branch filter set to '^main$'
Cloud Build triggers natively support branch filtering via the `included` or `ignored` branch filters. Setting the included branch filter to the regex `^main$` ensures the trigger only fires when a push event occurs on the `main` branch. This is the intended, serverless, and declarative way to achieve branch-specific builds without custom code or polling. The `^` and `$` anchors guarantee an exact match, preventing accidental triggers on branches like `feature/main` or `main-dev`.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Configure a Cloud Function that listens for Pub/Sub messages from Cloud Source Repo and calls Cloud Build API
Why it's wrong here
A custom Cloud Function adds bespoke Pub/Sub plumbing and API calls, whereas Cloud Build triggers natively consume Cloud Source Repository push events with branch filters. It is tempting when integrating unsupported sources, where custom event handling is genuinely required.
- ✓
Create a Cloud Build trigger with an included branch filter set to '^main$'
Why this is correct
An included branch filter using the regex ^main$ restricts the trigger to pushes on the main branch only, satisfying the stem's requirement. Without that filter, the trigger would fire on every branch push, causing unwanted builds.
- ✗
Create a Cloud Scheduler job that runs a Pub/Sub push to Cloud Build every hour
Why it's wrong here
A scheduled Pub/Sub push runs on a fixed hourly timer, ignoring repository events and branch, so it builds regardless of pushes to main. It is tempting for periodic builds, where time-based triggering is the correct configuration rather than event-driven branch filtering.
- ✗
Use a Cloud Build build step that checks the branch name and aborts if not main
Why it's wrong here
Checking the branch name inside a build step does not prevent the build from being triggered in the first place; Cloud Build will still start the build and consume resources for every push to any branch, failing the requirement to trigger *only* on pushes to `main`. This approach is tempting because it works as a safety guard in CI/CD pipelines where a single trigger file must serve multiple branches, and would be correct if the goal were to run the build on all branches but conditionally skip deployment for non‑main branches.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
Learn chapter
Cloud Build and CI/CD Pipelines
Key term
Artifact Registry
Artifact Registry is a managed service for storing, managing, and securing container images and other software packages in a centralized repository.
Key term
Cloud Build
Cloud Build is a managed service that compiles source code into deployable artifacts, often used in continuous integration and continuous delivery pipelines.
About these practice questions
This PCA question is part of Courseiva's 807-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Google Cloud exam blueprint
This PCA practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCA exam.