The service account integrated with Bitbucket is unable to list projects:
gcloud projects list
#=>
Listed 0 items.
or set $MY_PROJECT:
gcloud config set project $MY_PROJECT
#=>
Updated property [core/project].
because the output above is immediately followed by this warning:
WARNING: You do not appear to have access to project [$MY_PROJECT] or it does not exist
The warning above contradicts the output of the following:
gcloud config list --format="value(core.project)"
#=>
$MY_PROJECT
Are there any missing steps or prerequisites in order to properly authorize this service account to list and set $MY_PROJECT?
My bitbucket-pipelines.yaml file:
name: Test google auth
image: google/cloud-sdk:latest
script:
- echo $KEY_FILE | base64 --decode --ignore-garbage > ~/google-key.json
- gcloud auth activate-service-account --key-file ~/google-key.json
- gcloud projects list
- gcloud config set project $MY_PROJECT
- gcloud container clusters get-credentials $MY_CLUSTER --region $REGION
services:
- docker