Search code examples
google-cloud-platformgoogle-cloud-rungoogle-cloud-build

Using Cloud Build and Cloud Run to do complex blue green deployments with gradual rollouts/immediate rollbacks on alerts


I've seen that blue-green deployments are possible using gcloud run services update-traffic and tagged revisions, and you can set the traffic percentage that a given revision has through that same command.

I'd also like to do the following with my Cloud Run revisions, however: once the green build is deployed, I'd like to switch a small amount of traffic to that build. Then, as days go by, I'd like to slowly raise the amount of traffic that goes to the green build, until it reaches 100%. I'd also like to be able to roll back to the blue build, based off of alerts that I set up (through logging and machine alerts).

I'd like all of this to be automated - I've currently got simple blue-green deployment set up to happen in Cloud Build, where once the green build has finished passing integration tests and deploying, 100% of traffic is sent to it.

But, is it possible to do the gradual rollout/rollback feature I'm describing above with Cloud Build, or some other GCP tool? Or is the only way for me to create a feature like this (with automated gradual rollouts/rollbacks based on alerts) only possible if I implement an app that does this myself?


Solution

  • Publishing this as a community wiki for others sake.

    As mentioned by @guillaume blaquiere

    It's a feature of Cloud Deploy. You can catch an alert from Cloud Monitoring and trigger the rollback process on Cloud Deploy. Roll back a target