2

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 gitlabci@bizao-hub.iam.gserviceaccount.com --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
tuomastik
  • 103
  • 4
GihanS
  • 121
  • 1
  • 3

2 Answers2

2

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

Ahmed Lotfy
  • 121
  • 3
0

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.