【问题标题】:gcloud builds submit raises 403 error for `iam.serviceAccounts.get`gcloud 构建提交为 `iam.serviceAccounts.get` 引发 403 错误
【发布时间】:2022-10-15 15:56:33
【问题描述】:

我有一个想从命令行运行的 Cloud Build。但是,当我尝试从终端运行构建时,它会引发此错误:

$ gcloud builds submit --region=asia-east1 --config cloudbuild.yaml
Creating temporary tarball archive of 1 file(s) totalling 96 bytes before compression.
Uploading tarball of [.] to [gs://<REDACTED>.tgz]
ERROR: (gcloud.builds.submit) PERMISSION_DENIED: generic::permission_denied: Permission iam.serviceAccounts.get is required to perform this operation on service account projects/<PROJECT_ID>/serviceAccounts/<MY_SERVICE_ACCOUNT>.

我已将角色 Service Account User 分配给上述服务帐户,以及在我的终端上登录到 gcloud 的用户(通过 gcloud auth 确认)。

我还应该在哪里授予权限iam.serviceAccounts.get

【问题讨论】:

    标签: google-cloud-platform google-cloud-build cloudbuild.yaml


    【解决方案1】:

    根据Service Account User role,它作为服务帐户运行操作。 最低级别的资源,您应该将此角色授予服务帐户将拥有iam.serviceAccounts.get

    尝试给出这个命令,然后再试一次

     gcloud iam service-accounts add-iam-policy-binding 
      PROJECT_NUMBER-compute@developer.gserviceaccount.com 
      --member="PRINCIPAL" 
      --role="roles/iam.serviceAccountUser"
    

    并检查此Deployment permissions 并检查来自here 的云构建权限。

    【讨论】:

      猜你喜欢
      • 2020-02-08
      • 2021-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-09
      • 1970-01-01
      • 1970-01-01
      • 2018-08-04
      相关资源
      最近更新 更多