【发布时间】:2020-10-28 05:15:40
【问题描述】:
假设我有一个像下面这样的cloudbuild.yaml 文件。还假设我可以在将gcloud 用于单独的功能(构建和运行)时手动运行和部署有问题的容器。
部署时,第三步导致报错ERROR: (gcloud.run.deploy) PERMISSION_DENIED: The caller does not have permission
steps:
# Build the container image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/[PROJECT_ID]/[IMAGE]:$COMMIT_SHA', '.']
# Push the image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/[PROJECT_ID]/[IMAGE]:$COMMIT_SHA']
# Deploy image to Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
args:
- 'run'
- 'deploy'
- '[SERVICE_NAME]'
- '--image'
- 'gcr.io/[PROJECT_ID]/[IMAGE]:$COMMIT_SHA'
- '--region'
- '[REGION]'
- '--platform'
- 'managed'
images:
- gcr.io/[PROJECT_ID]/[IMAGE]
【问题讨论】:
-
你没有说哪个步骤给出了错误。上面有 3 个。
-
@AhmetB-Google,已编辑以突出显示有问题的步骤。我在下面的回答突出了解决方案。
标签: google-cloud-platform google-cloud-build google-cloud-run