我做了什么:
我要执行的是:
gcloud firebase test android run --app ./app/build/outputs/apk/app-debug.apk
我得到的错误:
ERROR: (gcloud.firebase.test.android.run) Unable to access the test environment catalog: ResponseError 403: Not authorized for project <project-id>
问题
我做错了什么?我尝试使用所有服务帐户规则在 IAM 下添加服务帐户,但这没有帮助。
是否可以专门为服务帐户启用这些 API?我这样做只是为了完整的项目和 gmail 帐户:启用所需的 API。使用服务帐户登录后:“在 Google Developers Console API Library 页面中,启用 Google Cloud Testing API 和 Cloud Tool Results API。要启用这些 API,请在控制台顶部的搜索框中输入这些 API 名称,然后在该 API 的概述页面上单击启用 API。”
我到目前为止的详细步骤:
docker exec -it container bash
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update && sudo apt-get install google-cloud-sdk
gcloud init
# only if this service account does not already exist:
# gcloud iam service-accounts create continuous-integration
gcloud iam service-accounts keys create $JENKINS_HOME/gce-continuous-integration-key.json --iam-account=continuous-integration@<project-id>.iam.gserviceaccount.com
gcloud auth activate-service-account continuous-integration@<project-id>.iam.gserviceaccount.com --key-file=$JENKINS_HOME/gce-continuous-integration-key.json
gcloud auth login continuous-integration@<project-id>.iam.gserviceaccount.com
jenkins@VM:/$ gcloud config list
# returns:
[compute]
region = europe-west3
zone = europe-west3-c
[core]
account = continuous-integration@<project-id>.iam.gserviceaccount.com
disable_usage_reporting = True
project = <project-id>
Your active configuration is: [default]
最佳答案
尝试在 IAM 页面中授予服务帐户 Project->Editor 权限。要运行 Firebase 测试实验室测试,授权需要允许 gcloud 创建多种类型的云资源(测试矩阵、工具结果)以及将中间和最终测试结果文件写入项目的 Cloud Storage 存储桶。
关于android - gcloud Firebase Android 测试 : Unable to access the test environment catalog: ResponseError 403: Not authorized for project,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46917461/