title: GAE activate-service-account from drone pipeline (drone on k8s): No key could be detected
body: <p>I have drone running on a k8s cluster. One of my pipelines is for a GAE application.</p>
  
  <p>I've been fighting with secrets for a while. It's a bit of a mission to make my secrets available. What I ended up doing was loading my key file name and contents into drone as a pair of secrets, then in my pipeline doing this:</p>
  
  <pre><code>  - echo $GOOGLE_KEY_CONTENTS &gt; "/etc/google-keys/$${GOOGLE_KEY_NAME}.json"
  </code></pre>
  
  <p>If I <code>ls</code> or <code>cat</code> then the file is there and everything seems to be in order.</p>
  
  <p>I then run:</p>
  
  <pre><code>- gcloud auth activate-service-account --key-file=/etc/google-keys/$${GOOGLE_KEY_NAME}.json
  </code></pre>
  
  <p>And the result is:</p>
  
  <pre><code>ERROR: gcloud crashed (ValueError): No key could be detected.
  </code></pre>
  
  <p>The key is there and looks fine to me</p>
  
  <p>I also tried:</p>
  
  <pre><code>- gcloud info --run-diagnostics
  </code></pre>
  
  <p>And got the following output:</p>
  
  <pre><code>Network diagnostic detects and fixes local network connection issues.
  Checking network connection...
  done.
  Reachability Check passed.
  Network diagnostic (1/1 checks) passed.
  </code></pre>
  
  <p>If I try to authenticate with the same key file on my local machine it works just fine. </p>
  
  <p>I've also managed to authenticate to gcloud from within a drone build when the drone instance was not running in k8s, and the secret key file was in a shared volume. (Unfortunately using a volume like this on k8s is impractical because drone wants me to make the secrets available to the base system of every single cluster node, and I'm not gooing to do that)</p>
  
  <p>So either the k8s system is stopping gcloud from authenticating. Or I did something wrong when loading up my key. Or something else entirely.</p>