- A
Create a Cloud Function that invokes Cloud Build via API when a push event occurs.
Why wrong: Unnecessary complexity.
- B
Add a build step in cloudbuild.yaml that polls the repository.
Why wrong: cloudbuild.yaml defines build steps, not triggers.
- C
Configure a Cloud Pub/Sub topic to notify Cloud Build on push events.
Why wrong: Cloud Build can directly listen to Cloud Source Repositories.
- D
Create a build trigger in Cloud Build with a regex pattern for the branch name.
Build triggers with branch patterns are the correct approach.
Cloud Build Trigger Configuration with Branch Filters
This PCD practice question tests your understanding of integrating google cloud services. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
You are designing a CI/CD pipeline using Cloud Build. You want to automatically trigger a build when code is pushed to a specific branch in Cloud Source Repositories. What is the correct configuration?
Quick Answer
The correct answer is to create a build trigger in Cloud Build with a regex pattern for the branch name. This is because Cloud Build natively listens for push events from Cloud Source Repositories and uses a regular expression to match the target branch, allowing you to automate cloud build triggers with branch filters without needing any intermediary services like Pub/Sub or Cloud Functions. On the Google Professional Cloud Developer exam, this tests your understanding of Cloud Build’s native trigger configuration, often appearing in scenarios where you must distinguish between event-driven triggers and manual invocations. A common trap is assuming you need a separate service to filter branches, but Cloud Build’s trigger regex handles this directly. Memory tip: think “regex on push” — the trigger pattern is the branch filter, not the branch name itself.
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 build trigger in Cloud Build with a regex pattern for the branch name.
Option D is correct because Cloud Build natively supports build triggers that can be configured to automatically start a build when code is pushed to a specific branch in Cloud Source Repositories. The trigger uses a regex pattern to match the branch name, and Cloud Build listens for repository push events directly without requiring additional services.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Create a Cloud Function that invokes Cloud Build via API when a push event occurs.
Why it's wrong here
Unnecessary complexity.
- ✗
Add a build step in cloudbuild.yaml that polls the repository.
Why it's wrong here
cloudbuild.yaml defines build steps, not triggers.
- ✗
Configure a Cloud Pub/Sub topic to notify Cloud Build on push events.
Why it's wrong here
Cloud Build can directly listen to Cloud Source Repositories.
- ✓
Create a build trigger in Cloud Build with a regex pattern for the branch name.
Why this is correct
Build triggers with branch patterns are the correct approach.
Related concept
Read the scenario before looking for a memorised answer.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The PCD exam often tests the misconception that Cloud Pub/Sub is always required for event-driven triggers, but Cloud Build has a native trigger integration with Cloud Source Repositories that bypasses Pub/Sub entirely.
Detailed technical explanation
How to think about this question
Cloud Build triggers use a webhook-like mechanism where Cloud Source Repositories sends a push event directly to Cloud Build's internal event bus. The trigger configuration includes a branch regex (e.g., '^main$' or '^feature-.*') that is evaluated against the pushed branch. This avoids the latency and complexity of intermediate services like Pub/Sub or Cloud Functions, making it the simplest and most reliable approach for repository-based triggers.
KKey Concepts to Remember
- Read the scenario before looking for a memorised answer.
- Find the constraint that changes the correct option.
- Eliminate answers that are true in general but not in this case.
TExam Day Tips
- Watch for words such as best, first, most likely and least administrative effort.
- Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A cloud solutions architect for a retail company is evaluating services for a new workload. The correct answer here reflects best practice for the specific scenario described — not a general cloud recommendation. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Cloud exam questions reward reading the constraint carefully: the same technology can be right or wrong depending on the use case.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
- →
Integrating Google Cloud services — study guide chapter
Learn the concepts, then practise the questions
- →
Integrating Google Cloud services practice questions
Targeted practice on this topic area only
- →
All PCD questions
999 questions across all exam domains
- →
Google Professional Cloud Developer study guide
Full concept coverage aligned to exam objectives
- →
PCD practice test guide
How to use practice tests most effectively before exam day
Related practice questions
Related PCD practice-question pages
Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.
Manage a Solution that Can Span Multiple Database Systems practice questions
Practise PCD questions linked to Manage a Solution that Can Span Multiple Database Systems.
Deploy Scalable and Highly Available Databases in Google Cloud practice questions
Practise PCD questions linked to Deploy Scalable and Highly Available Databases in Google Cloud.
Design Scalable and Highly Available Cloud Database Solutions practice questions
Practise PCD questions linked to Design Scalable and Highly Available Cloud Database Solutions.
Migrate Data Solutions practice questions
Practise PCD questions linked to Migrate Data Solutions.
Designing highly scalable, available, and reliable cloud-native applications practice questions
Practise PCD questions linked to Designing highly scalable, available, and reliable cloud-native applications.
Building and testing applications practice questions
Practise PCD questions linked to Building and testing applications.
Deploying applications practice questions
Practise PCD questions linked to Deploying applications.
Integrating Google Cloud services practice questions
Practise PCD questions linked to Integrating Google Cloud services.
Managing application performance monitoring practice questions
Practise PCD questions linked to Managing application performance monitoring.
PCD fundamentals practice questions
Practise PCD questions linked to PCD fundamentals.
PCD scenario practice questions
Practise PCD questions linked to PCD scenario.
PCD troubleshooting practice questions
Practise PCD questions linked to PCD troubleshooting.
Practice this exam
Start a free PCD practice session
Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.
FAQ
Questions learners often ask
What does this PCD question test?
Integrating Google Cloud services — This question tests Integrating Google Cloud services — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Create a build trigger in Cloud Build with a regex pattern for the branch name. — Option D is correct because Cloud Build natively supports build triggers that can be configured to automatically start a build when code is pushed to a specific branch in Cloud Source Repositories. The trigger uses a regex pattern to match the branch name, and Cloud Build listens for repository push events directly without requiring additional services.
What should I do if I get this PCD question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
3 more ways this is tested on PCD
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A company is using Cloud Build for CI/CD. They want to automatically trigger builds when code is pushed to a Cloud Source Repository and store the resulting Docker images in a secure, immutable artifact store. Which TWO services should they use? (Choose 2)
medium- ✓ A.Cloud Source Repository
- B.Cloud Storage
- ✓ C.Artifact Registry
- D.Cloud Functions
- E.Container Registry
Why A: Cloud Source Repository hosts the code and can trigger Cloud Build. Artifact Registry is the recommended immutable artifact store for Docker images. Container Registry is deprecated. Cloud Storage and Cloud Functions are not directly involved.
Variation 2. A company uses Cloud Build to build Docker images and push to Artifact Registry. They want to trigger builds automatically when code is pushed to a Cloud Source Repository branch. They also need to ensure that only builds from the repository's main branch are allowed to push to the production Artifact Registry repository. What is the best way to implement this?
hard- A.Use Cloud Source Repository webhooks and a Cloud Function to call Cloud Build
- B.Use Cloud Build triggers and configure separate service accounts for each branch
- ✓ C.Use Cloud Build triggers with branch filter and use IAM conditions on the Artifact Registry to restrict push based on the Cloud Build service account
- D.Use Cloud Build triggers with substitution variables and separate build configurations
Why C: Option C is correct because Cloud Build triggers with a branch filter can be set to only trigger on the main branch, and IAM conditions on the Artifact Registry can restrict push access based on the Cloud Build service account, ensuring only builds from the main branch can push to the production repository. Option A is overly complex and unnecessary. Option B does not enforce branch-level restrictions. Option D is less direct and harder to manage.
Variation 3. A team uses Cloud Build to deploy a microservice to Cloud Run. They want to enforce that only builds from the main branch trigger deployments to the production Cloud Run service. What is the best approach?
medium- A.Configure Cloud Run to only accept revisions from a specific source repository.
- B.Use IAM conditions on the Cloud Run service account to allow only main branch builds.
- ✓ C.Use Cloud Build triggers with a branch filter set to ^main$.
- D.Create a separate Cloud Build trigger for each branch and manually disable non-main triggers.
Why C: Option C is correct because Cloud Build triggers support branch filters to control which branches trigger builds. By setting the branch filter to ^main$, only commits to the main branch will initiate the build and subsequent deployment to Cloud Run. Option A is wrong because Cloud Run does not filter revisions by source repository; it deploys whatever image is pushed. Option B is wrong because IAM conditions control who can perform actions, not which branch triggered a build. Option D is wrong because it requires manual management and is error-prone; Cloud Build automatically handles branch filtering.
Keep practising
More PCD practice questions
- A company is deploying a microservices architecture on GKE. They need to expose a set of related microservices under a s…
- You need to monitor the CPU usage of a Compute Engine instance and trigger an alert when it exceeds 80% for 5 minutes. W…
- A Cloud Bigtable instance has a single cluster. To improve availability and read throughput, the team decides to add a s…
- A developer wants to enable IAM database authentication for Cloud SQL for PostgreSQL. Which IAM role must be granted to…
- A company is using Cloud Bigtable for a time-series workload. They want to monitor performance and identify hot spots. W…
- A company wants to run hybrid transactional/analytical processing (HTAP) workloads on a PostgreSQL-compatible database w…
Last reviewed: Jun 11, 2026
This PCD 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 PCD exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.