Google Professional Cloud DevOps Engineer exam dumps

Google Professional Cloud DevOps Engineer practice question 209 of 268

Professional Cloud DevOps Engineer. Associate level, Google Cloud. Free question with the correct answer and a full explanation.

Google Professional Cloud DevOps Engineer Question 209

Single answerGoogle Cloud Platform

Your company deploys a microservices-based application on Google Kubernetes Engine (GKE). The CI/CD pipeline is configured using Cloud Build. The development team wants to ensure that the pipeline automatically triggers a new build and deployment whenever changes are pushed to the main branch of the Git repository. Additionally, they want to avoid triggering builds for changes made to feature branches. How should you configure the pipeline triggers to meet these requirements?

  1. A

    Create a Cloud Build trigger that listens for changes in all branches and add a condition in the build script to validate the branch name.

  2. B

    Create a Cloud Build trigger and set the trigger type to 'Push to a branch' with the branch filter set to 'main'.

  3. C

    Create a Cloud Build trigger with the trigger type set to 'Pull request' and specify the main branch as the target.

  4. D

    Create a Pub/Sub topic that listens to Git events and use it to trigger Cloud Build for changes to the main branch.

Show answer and explanation

Correct answer: B

Explanation

To meet the requirement of triggering builds only for changes pushed to the main branch, a Cloud Build trigger with 'Push to a branch' as the trigger type and the branch filter set to 'main' is the most efficient and straightforward solution. Other options either introduce unnecessary complexity or do not satisfy the requirement of filtering events based on the branch.

  • A. Incorrect.

    This approach would result in unnecessary builds for changes made to feature branches, even though the condition in the build script prevents deployments. It does not prevent triggering builds for feature branches, thus not meeting the requirement.

  • B. Correct.

    This is the correct approach. Configuring a Cloud Build trigger with 'Push to a branch' and setting the branch filter to 'main' ensures that builds are triggered only for changes pushed to the main branch, meeting the requirements effectively.

  • C. Incorrect.

    Pull request triggers are used for validating or testing code before merging it into a branch, not for triggering builds on branch changes after the code is merged. This does not meet the requirement.

  • D. Incorrect.

    Using a Pub/Sub topic for Git events introduces unnecessary complexity when Cloud Build triggers are a simpler and more direct solution. It also requires additional configuration to filter events for the main branch.

Timed practice exam

Take a Google Professional Cloud DevOps Engineer practice test under exam conditions

60 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam