Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcloud Firebase Android Test: Unable to access the test environment catalog: ResponseError 403: Not authorized for project

What I did:

  • I set up gcloud on a jenkins docker container with this guide: https://firebase.google.com/docs/test-lab/continuous

What I want to execute:

gcloud firebase test android run --app ./app/build/outputs/apk/app-debug.apk

The error I get:

ERROR: (gcloud.firebase.test.android.run) Unable to access the test environment catalog: ResponseError 403: Not authorized for project <project-id>

Question

What am I doing wrong? I tried to add the service account under IAM with all Service-Account rules, but this didn't help.

Is it possible to enable these APIs specially for the service-account? I did so only for the complete project and gmail account: Enable required APIs. After logging in using the service account: "In the Google Developers Console API Library page, enable the Google Cloud Testing API and Cloud Tool Results API. To enable these APIs, type these API names into the search box at the top of the console, and then click Enable API on the overview page for that API. "

My steps so far in detail:

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]
like image 734
hb0 Avatar asked Oct 24 '17 18:10

hb0


1 Answers

Try giving the service account Project->Editor privileges in the IAM page. To run Firebase Test Lab tests, the authorization needs to allow gcloud to create several types of Cloud resources (test matrices, tool results) as well as to write intermediate and final test result files into your project's Cloud Storage bucket.

like image 120
P. Davis Avatar answered Nov 14 '22 23:11

P. Davis