Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

ERROR: (gcloud.auth.activate-service-account)

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

2 answers

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

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

0 votes

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

@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)

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,

@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.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Announcing the waitlist for Jira Work Management

Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...

640 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you