Greetings,
I have a service account json file located in the root directory of my pipeline - still in development mode - and when I try to run the pipeline, I get the following error:
ERROR: (gcloud.auth.activate-service-account) Could not read json file /tmp/key-file.json: Expecting value: line 1 column 1 (char 0)
Here is my pipe:
- pipe: atlassian/google-app-engine-deploy:0.7.0
variables:
KEY_FILE: 'gcloud-api-key.json'
Not sure why it won't find it?
Thanks,
Adam
Hello, @Adam_Woloszyn , you can recheck environment variable KEY_FILE. This should base64 encoded string , not filename. So the setting would be
KEY_FILE: $(cat gcloud-api-key.json').
This json file should contain proper base64 content and
This can be a tricky part, but we have a guide for this
https://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html#UseSSHkeysinBitbucketPipelines-UsemultipleSSHkeysinyourpipeline , section "Use multiple SSH keys in your pipeline".
You can use the same approach for your key.
We will update the documentation to be more clear in future releases
Greetings,
I appreciate your reply, however that didn't seem to work:
bash: /opt/atlassian/pipelines/agent/tmp/bashScript4455552900426182708.sh: line 72: unexpected EOF while looking for matching `''
I'll keep trying different things though.
Thanks,
Adam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Adam Woloszyn , could you provide the full log, please? I don't see json parsed here related, only bash
This solution I proposed for local testing
KEY_FILE: $(cat gcloud-api-key.json'),
but you can still refer to confluence docs I mentioned to set environment variable right in the pipeline (Deployments section, Repository Variables)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It worked with this: KEY_FILE: $(cat encoded.json)
But I will read the article.
Weird part is that nothing showed up in my Deployments section after using that pipe. I thought that was the point of it?
Thanks for the help - if you know more about the Deployment sections that'd be helpful too!
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Adam Woloszyn to answer on your question, I need to know, what exactly has not been shown up.
For example, secured variables like KEY_FILE , they are shown in Deployments section variables, but masked. And in the logs they are not shown.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Adam Woloszyn I guess you define key file variable as path variable where encoded string lies.
This is not the base case of usage.Obtain KEY_FILE variable (and put to the repository variable) like this:
base64 < your-service-account-file.json - you will have base64 encoded string. Put such string to the repository (or deployment) variable and name it KEY_FILE.
Regards, Galyna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
More of the error.
googlecloudsdk.api_lib.auth.service_account.BadCredentialFileException: Could not read json file /tmp/key-file.json: Expecting value: line 1 column 1 (char 0)
ERROR: (gcloud.auth.activate-service-account) Could not read json file /tmp/key-file.json: Expecting value: line 1 column 1 (char 0)
The strange part is that I can execute these commands just fine if I use a normal step script. Just having issues with the pipe itself.
script:
- gcloud auth activate-service-account --key-file ./gcloud-api-key.json
- gcloud config set project project-slug
- gcloud auth configure-docker --quiet
- gcloud app deploy --quiet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, @Adam Woloszyn , you can recheck environment variable KEY_FILE. This should base64 encoded string , not filename. So the setting would be
KEY_FILE: $(cat gcloud-api-key.json').
This json file should contain proper base64 content and
This can be a tricky part, but we have a guide for this
https://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html#UseSSHkeysinBitbucketPipelines-UsemultipleSSHkeysinyourpipeline , section "Use multiple SSH keys in your pipeline".
You can use the same approach for your key.
We will update the documentation to be more clear in future releases
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, @Adam Woloszyn .
Haven't you encountered on manual scripting below?
- gcloud auth activate-service-account --key-file ./gcloud-api-key.json
- gcloud config set project project-slug
- gcloud auth configure-docker --quiet
- gcloud app deploy --quiet
Like `gcloud : command not found`
Also, I would like to ask if you resolved the original issue with `atlassian/google-app-engine-deploy:0.7.0`?
Hoping for your reply.
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.