actions-hub / gcloud

GitHub Action for interacting with Google Cloud Platform (GCP)
https://github.com/marketplace/actions/google-cloud-platform-gcp-cli-gcloud
MIT License
229 stars 28 forks source link

base64: truncated base64 input #11

Closed xerosanyam closed 4 years ago

xerosanyam commented 4 years ago

Got this error when added key.json to GitHub secret directly. The solution is to convert the key to base64, as the README of this repo says.

If possible, can we improve this error message? Thanks for the hard work! :)

matteobart commented 4 years ago

Yeah I'm actually having the same issue here. I tried encoding in different ways to no avail!

xerosanyam commented 4 years ago

converting to base64 didn't work for you? how did you convert?

exelban commented 4 years ago

@matteobart key must be converted to base64. You can do it with the this command: base64 ~/<account_id>.json

matteobart commented 4 years ago

Yes I did use this command: base64 ~/<account_id>.json > encodedFile then placed the path to the encoded file in the secrets under GOOGLE_APPLICATION_CREDENTIALS And then I get the following error:

Screen Shot 2020-06-23 at 3 47 26 PM

Writing this out I may have found the issue... Should the secret's value be the encoded value after running base64 ~/<account_id>.json rather than have it be the path (to the file with the encoded value)?

exelban commented 4 years ago

@matteobart just copy the output of base64 ~/<account_id>.json to the APPLICATION_CREDENTAILS secret.

exelban commented 4 years ago

As I understand placed the path to encodedFile in GOOGLE_APPLICATION_CREDENTIALS. It will not work in this way.

In secrets you can keep some sensitive data. Usually, it's some credentials. You can put the path to some of your encodedFile in secret. It will mean, that action must go to this url and fetch the credentials from it. But this action cannot load credentials from the external source (s3 etc).

exelban commented 4 years ago

Ok, credentials must be encoded with base64. If you want to change it, you are welcomed to make a PR with this change. But do not forget to support a base64 format too.

devpascoe commented 4 years ago

i had to move my downloaded json file to my root user folder. then the base64 command worked.