PROFESSIONAL-CLOUD-DEVOPS-ENGINEER practice question 21 of 25

[Building and implementing CI/CD pipelines for a service] Your application images are built and pushed to Google Container Registry (GCR). You want to build an automated pipeline that deploys the application when the image is updated while minimizing the development effort. What should you do?

Full set: 205 questions
Answer options
A: Use Cloud Build to trigger a Spinnaker pipeline.
B: Use Cloud Pub/Sub to trigger a Spinnaker pipeline. Correct answer
C: Use a custom builder in Cloud Build to trigger a Jenkins pipeline.
D: Use Cloud Pub/Sub to trigger a custom deployment service running in Google Kubernetes Engine (GKE).
Correct Answer:
B. Use Cloud Pub/Sub to trigger a Spinnaker pipeline.
Explanation

The most direct and efficient way to trigger a deployment pipeline upon a new image push to Container Registry (GCR) is by using the built-in Pub/Sub integration. GCR automatically publishes messages to a specific Pub/Sub topic (gcr) whenever an image is pushed. Spinnaker has native support for Pub/Sub triggers, allowing it to listen to this topic and automatically start a pipeline. This approach requires minimal configuration and no custom code, directly addressing the "minimizing development effort" requirement.

Why Incorrect

A. Using Cloud Build as an intermediary adds an unnecessary step and complexity compared to the direct Pub/Sub trigger that Spinnaker natively supports.
C. This option introduces Jenkins and a custom builder, which is more complex and deviates from the goal of using a tool like Spinnaker for deployment automation.
D. Building a custom deployment service in GKE requires significant development and maintenance effort, which is the opposite of the stated goal to minimize it.

References

1. Google Cloud Documentation, "Configuring Container Registry for Pub/Sub notifications": "Container Registry can use Pub/Sub to publish changes to your repository... You can configure other applications, such as Spinnaker, to subscribe to these Pub/Sub messages and trigger actions such as new software deployments."

2. Spinnaker Documentation, "Google Pub/Sub Triggers": "You can use Google Cloud Pub/Sub messages to trigger Spinnaker pipelines. This is a very powerful integration, and is the basis for many of the other Google integrations in Spinnaker... For example, you can trigger a pipeline whenever a new Docker image is pushed to Google Container Registry."

Scroll to Top