Google Professional Cloud DevOps Engineer Question 60
Single answerGoogle Cloud PlatformYou are responsible for setting up a CI/CD pipeline for a team developing a microservices application on Google Cloud Platform. The team wants the pipeline to automatically trigger deployments to the staging environment only when new code is pushed to the 'release' branch in the repository. How can you configure the pipeline to meet this requirement?
- A
Use Cloud Build with a trigger configured to run when changes are pushed to the 'release' branch.
- B
Configure a Cloud Scheduler job to periodically check for changes in the 'release' branch and trigger the pipeline.
- C
Set up a Pub/Sub topic that listens for repository events and triggers the pipeline when changes are pushed to any branch.
- D
Use Cloud Build with a trigger that listens for a specific tag pattern instead of branch changes.
Show answer and explanation
Correct answer: A
Explanation
Cloud Build allows you to define branch-specific triggers, which is ideal for this scenario where the pipeline must automatically deploy to staging when changes are pushed to the 'release' branch. This ensures an event-driven, efficient, and accurate CI/CD pipeline configuration.
- A. Correct.
This is correct. Cloud Build supports branch-specific triggers, allowing you to configure the pipeline to trigger only when changes are pushed to the 'release' branch.
- B. Incorrect.
This is incorrect. While Cloud Scheduler can be used for periodic tasks, it is inefficient and not event-driven, which does not align with the requirement for automatic branch-specific triggers.
- C. Incorrect.
This is incorrect. A Pub/Sub topic listening for events from any branch does not provide the necessary granularity to trigger deployments exclusively for the 'release' branch.
- D. Incorrect.
This is incorrect. A trigger based on tag patterns is not suitable for this scenario, as the requirement is to trigger on branch-specific changes, not tags.