Courseiva
Managing and Provisioning a Solution InfrastructuremediumMultiple ChoiceObjective-mapped

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?

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 can be configured with a branch filter (regex) to trigger builds only on specific branches. The trigger is set to watch the repository and fire on push events matching the branch pattern. Using a Cloud Scheduler with Pub/Sub is an alternative for scheduled builds, but not for push-based triggers.

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

    This is overly complex; Cloud Build triggers natively support repository push events.

  • Create a Cloud Build trigger with an included branch filter set to '^main$'

    Why this is correct

    The branch filter '^main$' ensures only pushes to the main branch trigger a build.

  • Create a Cloud Scheduler job that runs a Pub/Sub push to Cloud Build every hour

    Why it's wrong here

    This would trigger builds on a schedule, not on pushes to a specific branch.

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

About these practice questions

This PCA question is part of Courseiva's 955-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 →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.