I deployed two Cloud Run services (staging and production) using GCP Cloud Build with this command:
entrypoint: gcloud
args: ['run', 'deploy', 'app', '--project', '$PROJECT_ID', '--image', 'image:$COMMIT_SHA', '--region', 'us-central1', '--allow-unauthenticated', '--memory' , '256Mi', '--update-env-vars', 'ENV=production']
I noticed that the same command has different behavior on staging and production. On one of my services, the traffic is not routed automatically to the newest revision.
Already have image (with digest):
Deploying container to Cloud Run service
Deploying...
Setting IAM Policy..............done
Creating Revision..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................done
Done.
Service [] revision [] has been deployed and is serving 0 percent of traffic.
I am missing this step :
Routing traffic......done
I checked the cloud run service.yaml
and the traffic argument is set :
traffic:
- latestRevision: true
percent: 100
If I run the same command on GCP console, everything works as expected.
Question:
Why gcloud run deploy
does not route the traffic when I am running from Cloud Build pipeline ? ( I do not have --no traffic
flag set)
gcloud run deploy prod --project xxxx --image image:xxx --region us-central1 --allow-unauthenticated --memory 256Mi --update-env-vars ENV=production
– marian.vladoi