
Answer-first summary for fast verification
Answer: 1. Trigger Cloud Build to run unit tests when the code is pushed. If all unit tests are successful, build and push the application container to a central registry. 2. Trigger Cloud Build to deploy the container to a testing environment, and run integration tests and acceptance tests. 3. If all tests are successful, the pipeline deploys the application to the production environment and runs smoke tests
The question focuses on building a CI/CD pipeline for a containerized application in Google Cloud using trunk-based development, emphasizing automated testing to improve quality. Option D is the correct choice because: 1. **Automated Pipeline**: It fully automates the testing process within Cloud Build, eliminating reliance on client-side Git hooks (which are unreliable and bypassable). This aligns with CI/CD best practices for consistency and scalability. 2. **Testing Strategy**: Unit tests run in the pipeline during the build phase (step 1), ensuring code quality before containerization. Integration and acceptance tests run in a dedicated testing environment (step 2), validating functionality in a production-like setting before deployment. This avoids running acceptance tests in production (as in options A and C), reducing risk. 3. **Image Consistency**: The container is built and pushed to a registry once (step 1), then reused across environments (testing and production), ensuring artifact immutability. This prevents inconsistencies from rebuilding at multiple stages (e.g., option B). 4. **Safe Production Deployment**: Smoke tests run post-deployment (step 3) to quickly verify production stability, providing a final safety net without exposing users to potential failures from incomplete testing. Options A and C run acceptance tests in production, risking outages if tests fail. Option B relies on error-prone Git hooks and rebuilds the container unnecessarily, violating pipeline efficiency principles.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
How can you implement a CI/CD pipeline for a containerized application in Google Cloud that supports trunk-based development from a central Git repository and ensures all tests are executed for new application versions to enhance quality?
A
B
C
D