nerdexam
Google

PROFESSIONAL-CLOUD-DEVOPS-ENGINEER · Question #61

You need to build a CI/CD pipeline for a containerized application in Google Cloud. Your development team uses a central Git repository for trunk-based development. You want to run all your tests in t

The correct answer is D. 1. Trigger Cloud Build to run unit tests when the code is pushed. If all unit tests are successful,. To build a CI/CD pipeline for a containerized application using trunk-based development, trigger Cloud Build upon code pushes to automatically run unit tests.

Submitted by deeparc· Apr 18, 2026Building and implementing CI/CD pipelines for a service

Question

You need to build a CI/CD pipeline for a containerized application in Google Cloud. Your development team uses a central Git repository for trunk-based development. You want to run all your tests in the pipeline for any new versions of the application to improve the quality. What should you do?

Options

  • A
    1. Install a Git hook to require developers to run unit tests before pushing the code to a central
  • B
    1. Install a Git hook to require developers to run unit tests before pushing the code to a central
  • C
    1. Trigger Cloud Build to build the application container, and run unit tests with the container.
  • D
    1. Trigger Cloud Build to run unit tests when the code is pushed. If all unit tests are successful,

How the community answered

(37 responses)
  • A
    11% (4)
  • B
    3% (1)
  • C
    5% (2)
  • D
    81% (30)

Why each option

To build a CI/CD pipeline for a containerized application using trunk-based development, trigger Cloud Build upon code pushes to automatically run unit tests.

A1. Install a Git hook to require developers to run unit tests before pushing the code to a central

Git hooks are client-side and require developers to run tests *before* pushing, which doesn't guarantee testing for all new versions *in the pipeline* after a push, nor does it leverage Cloud Build for central CI.

B1. Install a Git hook to require developers to run unit tests before pushing the code to a central

Git hooks are client-side and require developers to run tests *before* pushing, which doesn't guarantee testing for all new versions *in the pipeline* after a push, nor does it leverage Cloud Build for central CI.

C1. Trigger Cloud Build to build the application container, and run unit tests with the container.

Running unit tests *with the container* after building it might be less efficient or flexible than running tests as a dedicated step *before* image creation, and it doesn't explicitly state the trigger upon push.

D1. Trigger Cloud Build to run unit tests when the code is pushed. If all unit tests are successful,Correct

When code is pushed to the central Git repository, Cloud Build is triggered to automatically run unit tests. This ensures that only code that passes initial quality checks proceeds to subsequent build and deployment steps, which is crucial for trunk-based development and improving application quality.

Concept tested: Automated CI/CD with Cloud Build triggers

Source: https://cloud.google.com/build/docs/automating-builds/create-triggers

Topics

#CI/CD pipelines#Cloud Build#Automated testing#Git integration

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVOPS-ENGINEER Practice