尝试部署简单功能时,我遇到403错误。这是我完整的yaml:
steps:
# Install Dependencies
- name: 'python'
id: Pip install
args: ['pip3', 'install', '-r', 'requirements.txt', '--user']
# Run Tests
- name: 'python'
args: ['python3', '-m', 'pytest', 'functions/folder_a/test/']
# Deploy Cloud Functions
- name: 'gcr.io/cloud-builders/gcloud'
id: 'helloFunction'
args: ['functions', 'deploy', 'hello', '--source' , 'functions/folder_a/main.py',
'--runtime' , 'python37' ,'--trigger-http']
第一步可以很好地完成,但是第二步出错。
$ gcloud info
Account: [[email protected]]
Project: [projectname]
Current Properties:
[core]
project: [projectname]
account: [[email protected]]
disable_usage_reporting: [True]
我尝试将以下权限添加到IAM中的上述帐户:
运行Google Build时,使用的是哪个服务帐户?如何更改权限以允许自动部署功能?
https://cloud.google.com/functions/docs/bestpractices/testing#continuous_testing_and_deployment中记录了使用Cloud Build部署Cloud Functions的信息。
在该页面上,指导是:
- 要部署Cloud Functions,您可能需要将Cloud Functions Developer角色分配给Cloud Build服务帐户([email protected])。
- 如果您使用Cloud Functions Developer角色,则还需要向Cloud Functions Runtime服务帐户([email protected])授予IAM服务帐户用户角色。
Cloud Build服务帐户为[email protected],如果您在控制台中查找该帐户,则只会有一个服务帐户 *@cloudbuild*
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句