ERROR: (gcloud.run.services.update) PERMISSION_DENIED: Permission 'run.services.get' denied on resource 'namespaces/*/services/test-repo'

ERROR: (gcloud.run.services.update) PERMISSION_DENIED: Permission 'run.services.get' denied on resource 'namespaces/*/services/test-repo'

我在 google 云中拥有以下权限。

  1. BigQuery 管理员
  2. 云功能管理员
  3. Cloud Scheduler 管理员
  4. 计算管理员
  5. 编辑器
  6. 源存储库管理员
  7. 存储管理员

我正在使用云存储库创建云 运行 容器。但是出现以下错误。

ERROR: build step 2 "gcr.io/google.com/cloudsdktool/cloud-sdk:slim" failed: step exited with non-zero status: 1 ERROR Finished Step #2 - "Deploy" Step #2 - "Deploy": ERROR: (gcloud.run.services.update) PERMISSION_DENIED: Permission 'run.services.get' denied on resource 'namespaces/buypower-mobile-app/services/test-repo' (or resource may not exist).

如果您使用 Cloud Build 来部署 Cloud 运行 服务,那么您收到的错误是因为 Cloud Build 使用的服务帐户没有足够的权限来更新 Cloud 运行服务,根据the official documentation.

具体错误是 run.services.get 的权限被拒绝。此方法是 roles/run.adminroles/run.developer 的一部分。这两个角色都包含权限 run.services.update,您也需要它。

要使其正常运行,您需要将其中一个角色添加到 Cloud Build 正在使用的服务帐户。