How to trigger Cloud Build for code changes?
Your team frequently creates new ML models and runs experiments. Your team pushes code to a single repository hosted on Cloud Source Repositories. You want to create a continuous integration pipeline that automatically retrains the models whenever there is any modification of the code. What should be your first step to set up the CI pipeline?
Community Votes
100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
This question tests the selection of the correct Cloud Build trigger event to capture all code changes, where the trap is choosing 'Pull Request' (Option A) which misses direct pushes, or Cloud Functions which are overkill for standard CI.
To automate ML model retraining in Google Cloud, use Cloud Build triggers integrated with Cloud Source Repositories. The community consensus confirms that setting the trigger event to 'Push to a branch' ensures the pipeline runs on every code modification.
Selecting Option A (Pull Request) is a common mistake because, while useful for testing, it does not cover direct pushes to branches, failing the requirement to retrain on 'any modification.'
Community Discussion (6 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option B is correct because Cloud Build is Google Cloud's native, fully managed CI/CD platform designed to automate builds and deployments. Configuring a trigger on 'Push to a branch' ensures that the pipeline activates whenever new code is committed to any branch, strictly satisfying the requirement to retrain models on 'any modification' of the code.Why the Other Options Are Wrong
Option A is incorrect because triggering on 'Pull Request' limits automation to only those changes associated with a PR, missing direct commits to the main branch. Options C and D are incorrect because implementing a Cloud Function to handle builds is unnecessarily complex and less efficient than using the native Cloud Build integration, which handles repository events automatically.Community Comment Notes
Community members emphasize that Cloud Build is the ideal tool for this task due to its seamless integration with Cloud Source Repositories. Several comments highlight that 'Push to a branch' is the superior choice over 'Pull Request' because it captures all code changes, including direct pushes to the main branch. While one comment noted the potential resource intensity of retraining on every push, Option B remains the technically correct answer to meet the specific criteria of the question.Official Reference
Exam Strategy
When questions ask for actions on 'any modification' or 'every change,' look for 'Push' events rather than 'Pull Request' events to ensure comprehensive coverage. Always prioritize native integrations like Cloud Build triggers over custom solutions like Cloud Functions for standard CI/CD scenarios.
Related Analysis
Practice All PMLE Questions
Access 65 questions with complete answers and detailed explanations.
View Full PMLE Practice Test →