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.
Question
Options
- A
- Install a Git hook to require developers to run unit tests before pushing the code to a central
- B
- Install a Git hook to require developers to run unit tests before pushing the code to a central
- C
- Trigger Cloud Build to build the application container, and run unit tests with the container.
- D
- Trigger Cloud Build to run unit tests when the code is pushed. If all unit tests are successful,
How the community answered
(37 responses)- A11% (4)
- B3% (1)
- C5% (2)
- D81% (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.
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.
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.
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.
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
Community Discussion
No community discussion yet for this question.