Question 478 of 500
Integrating Google Cloud servicesmediumMultiple ChoiceObjective-mapped

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.

PCD Integrating Google Cloud services Practice Question

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?

Question 1mediummultiple choice
Full question →

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

Cisco 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.

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.

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 →

How Courseiva writes practice questions · Editorial policy

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 A is correct because creating a Cloud Build trigger with a branch filter for the main branch and using a dedicated service account for that trigger with appropriate permissions on the production repository ensures only main branch builds can push to production. Option B does not restrict access per branch, option C is unnecessarily complex, and option D uses multiple service accounts but is less straightforward.

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 A is correct because Cloud Build triggers support branch filters to specify which branches trigger builds. Option B is wrong because Cloud Run cannot filter deployments by branch. Option C is wrong because IAM conditions apply to principals, not build sources. Option D is wrong because manual management is error-prone.

Last reviewed: Jun 11, 2026

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.

Loading comments…

Sign in to join the discussion.

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.