ahmetb / cloud-run-faq

Unofficial FAQ and everything you've been wondering about Google Cloud Run.
https://cloud.run
Creative Commons Attribution 4.0 International
2.32k stars 124 forks source link

Manage revision traffic #97

Closed maeglindeveloper closed 4 years ago

maeglindeveloper commented 4 years ago

Hi everyone,

I'm actually using Cloud Build & Cloud Run in my project.

For the CI/CD, I use a cloudbuild.yaml file to define the steps I need to perform to deploy my new revision of Cloud Run.

After several issue on traffic management, I had to add to my cloudbuild file a step to specify that the traffic should be set to 100% to the latest built revision. That is weird but it is working so... be it 👍

cloudbuild.yaml step

# Allocate 100% of the traffic to that new revision
- name: gcr.io/cloud-builders/gcloud
  args: ['run', 'services', 'update-traffic', '${_APP_NAME}', '--to-revisions=LATEST=100', '--platform', 'gke', '--cluster', 'xxxxxx', '--cluster-location', 'xxxxxxxxxxx', '--namespace', 'xxxxxxxx']

Unfortunetely, event if the traffic is well set, it always keeps "alive" the old revision 👎 .

image

What is strange is that it is not doing it when I'm doing it remotely using gcloud command.

Did you already have that issue in the past ?

Thanks for the help :)

ahmetb commented 4 years ago

Can you please ask this on Stackoverflow.com? This is not for troubleshooting type of questions.