
Answer-first summary for fast verification
Answer: Create a build trigger that runs the build file in response to a repository code being pushed to the development branch.
The most efficient way to deploy new code when using Cloud Run and Cloud Source Repositories is to set up an automated trigger that responds directly to code changes. Option B is correct because creating a Cloud Build trigger linked to the development branch ensures that every code push to that branch automatically triggers the build and deployment process defined in the Cloud Build YAML file. This approach eliminates manual steps and ensures rapid deployment. Options A and C introduce unnecessary complexity (Pub/Sub or webhooks) for this use case, as Cloud Build natively integrates with Cloud Source Repositories. Option D (Cron job) is inefficient as it does not deploy on code changes but relies on a fixed schedule.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
What is the next step to efficiently deploy new code to Cloud Run after setting up a Cloud Build YAML file that builds a container and executes gcloud run deploy?
A
Create a Pub/Sub topic to be notified when code is pushed to the repository. Create a Pub/Sub trigger that runs the build file when an event is published to the topic.
B
Create a build trigger that runs the build file in response to a repository code being pushed to the development branch.
C
Create a webhook build trigger that runs the build file in response to HTTP POST calls to the webhook URL.
D
Create a Cron job that runs the following command every 24 hours: gcloud builds submit.
No comments yet.