TransWikia.com

ERROR: (gcloud.auth.activate-service-account) Could not read json file /root/gcloud-service-key.json: No JSON object could be decoded

Server Fault Asked by GihanS on December 1, 2021

I’m getting the below error when running CI/CD pipeline in GitLab.

$ echo "$GCLOUD_SERVICE_KEY" > ${HOME}/gcloud-service-key.json
$ gcloud auth activate-service-account [email protected] --key-file=${HOME}/gcloud-service-key.json
ERROR: (gcloud.auth.activate-service-account) Could not read json file /root/gcloud-service-key.json: No JSON object could be decoded

2 Answers

I know this issue is old but for future readers:

"Variables can be protected. Whenever a variable is protected, it would only be securely passed to pipelines running on the protected branches or protected tags. The other pipelines would not get any protected variables."

=> protected branches or protected tags

So if the you have a protected variables then it will be only available for protected branches.

To mark your branch as protected check the below link: protected gitlab branch

Answered by Ahmed Lotfy on December 1, 2021

The error “No JSON object could be decoded” may indicate different issues.

1) Have you verified that your JSON file is valid. You can verify the format of your JSON file using an online JSON validator.

2) You will need to verify if the required APIs were enabled at that time.

You can also verify the GCP page for different JSON formatting examples.

Answered by Mohamad Bazzi on December 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP