Courseiva
Building and implementing CI/CD pipelineseasyMultiple ChoiceObjective-mapped

PCDOE Building and implementing CI/CD pipelines Practice Question

A development team wants to automatically run unit tests and static code analysis on every push to a Cloud Source Repository, but only run integration tests on merges to the main branch. Which Cloud Build trigger configuration should they use?

⚠ Common exam trap

The trap here is that candidates mistakenly think a single trigger with conditional steps or substitution variables can handle branch-specific logic, but Cloud Build triggers are designed to be event-filtered at the trigger level, not at the build step level.

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 two triggers: one with a branch filter for '^main$' that runs integration tests, and another with a branch filter for '^.*$' that runs unit tests.

Cloud Build triggers allow you to define separate triggers with branch filters to execute different build configurations based on the branch. By creating one trigger with a branch filter of '^main$' for integration tests and another with '^.*$' for unit tests, you ensure unit tests run on every push to any branch, while integration tests run only on merges to main. This approach directly maps the desired behavior without requiring conditional logic or manual intervention.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use a single trigger with a substitution variable like '_BRANCH' and set it to 'main' for integration tests.

    Why it's wrong here

    Substitutions are set at trigger creation, not at runtime based on branch.

  • Create one trigger with a build config that uses the 'branchName' substitution to conditionally skip integration test steps.

    Why it's wrong here

    Cloud Build does not support conditional step skipping based on substitutions.

  • Create two triggers: one with a branch filter for '^main$' that runs integration tests, and another with a branch filter for '^.*$' that runs unit tests.

    Why this is correct

    Correct: separate triggers with branch filters allow different pipelines per branch.

  • Configure one trigger with no branch filter and rely on developers to manually trigger integration tests.

    Why it's wrong here

    Defeats automation; manual triggers are not the intended solution.

About these practice questions

One of 486 original PCDOE practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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 PCDOE 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 PCDOE exam.