我使用 GCP Cloud Build 和以下命令部署了两个 Cloud Run 服务(暂存和生产):
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']
Run Code Online (Sandbox Code Playgroud)
我注意到相同的命令在暂存和生产中具有不同的行为。在我的一项服务上,流量不会自动路由到最新版本。
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
Run Code Online (Sandbox Code Playgroud)
我检查了云运行service.yaml
并设置了流量参数:
traffic:
- latestRevision: true
percent: 100
Run Code Online (Sandbox Code Playgroud)
如果我在 GCP 控制台上运行相同的命令,一切都会按预期运行。
问题: …