无法使用 Cloud Build 存储库第二代创建 Cloud Build 触发器 – 权限错误

huangapple go评论61阅读模式
英文:

Cannot create a Cloud Build trigger with Cloud Build repositories 2nd gen - permissions error

问题

我一直在遵循https://cloud.google.com/build/docs/automating-builds/github/connect-repo-github?generation=2nd-gen上的说明,从与Cloud Build存储库第2代连接的GitHub存储库创建Cloud Build触发器。

无论我是否像说明中那样使用gcloud,使用Google Cloud Console UI,甚至尝试通过Terraform编程方式,我都会收到相同的错误。

我无法确定是否需要在某个地方设置权限,还是只是一个误导性的错误,GitHub权限有问题。我的用户帐户具有roles/cloudbuild.connectionAdmin角色。我看不出为什么提到的权限不应存在。

无法获取存储库项目/my-project/locations/us-central1/connections/my-app-github-connection/repositories/MyApp的连接:generic::permission_denied:对项目/my-project-number/locations/us-central1/connections/my-app-github-connection的权限 'cloudbuild.connections.get' 被拒绝

这是Cloud Build服务帐户被授予的角色:

无法使用 Cloud Build 存储库第二代创建 Cloud Build 触发器 – 权限错误

有任何想法吗?

英文:

I have been following the instructions at https://cloud.google.com/build/docs/automating-builds/github/connect-repo-github?generation=2nd-gen to create a Cloud Build Trigger from a GitHub repo connected to Cloud Build repositories 2nd gen.

Whether I use gcloud as in the instructions, use the Google Cloud Console UI or even try programmatically via Terraform, I get the same error.

I cannot work out if I need to set permissions somewhere or if it is just a misleading error and something is wrong with the GitHub permissions. My user account has the roles/cloudbuild.connectionAdmin role. I cannot see why the mentioned permission would not be there.

connection of repository projects/my-project/locations/us-central1/connections/my-app-github-connection/repositories/MyApp cannot be fetched: generic::permission_denied: Permission 'cloudbuild.connections.get' denied on 'projects/my-project-number/locations/us-central1/connections/my-app-github-connection'

Here is the roles the Cloud Build service account has granted:

无法使用 Cloud Build 存储库第二代创建 Cloud Build 触发器 – 权限错误

Any ideas?

答案1

得分: 1

明白了,在下面的屏幕上,我必须启用秘密管理器秘密访问器。

我一直在为以下内容添加权限:

service-262018307079@gcp-sa-cloudbuild.iam.gserviceaccount.com

而不是:

262018307079@cloudbuild.gserviceaccount.com

英文:

Got it, I had to enable Secret Manager Secret Accessor on the screen below.

I had been adding permissions to :

service-262018307079@gcp-sa-cloudbuild.iam.gserviceaccount.com

rather than:

262018307079@cloudbuild.gserviceaccount.com.

无法使用 Cloud Build 存储库第二代创建 Cloud Build 触发器 – 权限错误

huangapple
  • 本文由 发表于 2023年5月25日 00:17:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76325556.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定