用于部署 google 云功能的服务帐户角色
service account roles to deploy google cloud function
我正在尝试使用服务帐户从 CI 使用 gcloud beta functions deploy
,但出现错误:
(gcloud.beta.functions.deploy) ResponseError: status=[403],
code=[Forbidden], message=[The caller does not have permission]
我在 IAM Web 控制台中找不到任何合适的角色。我用哪一个?
您始终可以从这两个选项开始。至少他们必须工作。
并确保设置所有必需的环境变量以使默认应用程序凭据正常工作。
检查您当前的配置:gcloud config list
查看结果并检查 project =
与目标项目的 PROJECT_ID.
完全相同
您可以列出您的项目:gcloud config set project
重要
Project =
未设置名称。必须设置 PROJECT_ID.
要部署函数,用户应具有角色 roles/cloudfunctions.developer
我通过在 UI 中改变角色发现了这一点。我找不到任何官方 google 文档。本文也提到了这个作用https://medium.com/google-cloud/triggering-cloud-functions-deployments-97691f9b5416
这是我的服务帐户(不是默认的 Cloud Functions 服务帐户)使用 CI 成功部署 Cloud Functions 所需的最低角色。
Cloud Functions Developer
Service Account User
来自文档
In order to assign a user the Cloud Functions Developer role (roles/cloudfunctions.developer) or a custom role that can deploy functions, you must also assign the user the IAM Service Account User role (roles/iam.serviceAccountUser) on the Cloud Functions Runtime service account.
参考:https://cloud.google.com/functions/docs/reference/iam/roles
我不明白的一件事是提到运行时服务帐户。您不必将服务帐户用户角色分配给运行时服务帐户,而是应该分配给您用于部署的 SA。(不确定我是否正确理解文档)
我正在尝试使用服务帐户从 CI 使用 gcloud beta functions deploy
,但出现错误:
(gcloud.beta.functions.deploy) ResponseError: status=[403], code=[Forbidden], message=[The caller does not have permission]
我在 IAM Web 控制台中找不到任何合适的角色。我用哪一个?
您始终可以从这两个选项开始。至少他们必须工作。
并确保设置所有必需的环境变量以使默认应用程序凭据正常工作。
检查您当前的配置:gcloud config list
查看结果并检查 project =
与目标项目的 PROJECT_ID.
您可以列出您的项目:gcloud config set project
重要
Project =
未设置名称。必须设置 PROJECT_ID.
要部署函数,用户应具有角色 roles/cloudfunctions.developer
我通过在 UI 中改变角色发现了这一点。我找不到任何官方 google 文档。本文也提到了这个作用https://medium.com/google-cloud/triggering-cloud-functions-deployments-97691f9b5416
这是我的服务帐户(不是默认的 Cloud Functions 服务帐户)使用 CI 成功部署 Cloud Functions 所需的最低角色。
Cloud Functions Developer Service Account User
来自文档
In order to assign a user the Cloud Functions Developer role (roles/cloudfunctions.developer) or a custom role that can deploy functions, you must also assign the user the IAM Service Account User role (roles/iam.serviceAccountUser) on the Cloud Functions Runtime service account.
参考:https://cloud.google.com/functions/docs/reference/iam/roles
我不明白的一件事是提到运行时服务帐户。您不必将服务帐户用户角色分配给运行时服务帐户,而是应该分配给您用于部署的 SA。(不确定我是否正确理解文档)