gsutil requires a project id
When running gsutil in an action.yml file, an error is thrown requiring a project id during configuration.
- run: |
# View storage
gsutil ls
You are attempting to perform an operation that requires a project id, with none configured. Please re-run gsutil config and make sure to follow the instructions for finding and entering your default project id.
However if gcloud is activated with a valid project_id, then, the gsutil command works correctly. For example, like the following:
gcloud auth activate-service-account --project=${someProject_id} --key-file=${tmpKeyFilePath}`
The problem may be here https://github.com/GoogleCloudPlatform/github-actions/blob/2a9cbc618184da4718e0d16a1b0a055a4f90f66e/setup-gcloud/src/setup-gcloud.ts#L84
Note there is no --project, which could be picked up from the key-file.
I think you should run
gsutil ls -p my-project
in your action to make it explicit. Depending on the type of service account, we may not be able to extract the project ID. Furthermore, you may be using a service account in project A but have access to buckets in project B. It feels a little too magical and thus I think explicitly saying the project (via -p) might be better. WDYT?
gcloud config set project [projectID]