title: Athenticating gcloud service account within gitlab CI/CD
body: <p>I am deploying a service to gcloud from gitlab-ci.yml file using gcloud-service-key.json. I get this error</p>
  <blockquote>
  <p>$ google-cloud-sdk/bin/gcloud auth activate-service-account --key-file
  ${HOME}/gcloud-service-key.json ERROR: gcloud crashed (ValueError): No
  key could be detected.</p>
  </blockquote>
  <p>Find below a subset of the code snippet</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code> - apk add --update make ca-certificates openssl python --repository https://alpine.global.ssl.fastly.net/alpine/v3.10/community --repository https://alpine.global.ssl.fastly.net/alpine/v3.10/main &amp;&amp; rm -fR /var/cache/apk/*
    - update-ca-certificates
    # Write our GCP service account private key into a file
    - echo $GCLOUD_SERVICE_KEY &gt; ${HOME}/gcloud-service-key.json
    # Download and install Google Cloud SDK
    - wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz
    - tar zxvf google-cloud-sdk.tar.gz &amp;&amp; ./google-cloud-sdk/install.sh --usage-reporting=false --path-update=true
    - google-cloud-sdk/bin/gcloud --quiet components update
    - google-cloud-sdk/bin/gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json</code></pre>
  </div>
  </div>
  </p>
  <p>Any help will be appraciated, I've been at this for several days now.</p>