I have drone running on a k8s cluster. One of my pipelines is for a GAE application.
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:
- echo $GOOGLE_KEY_CONTENTS > "/etc/google-keys/$${GOOGLE_KEY_NAME}.json"
If I ls
or cat
then the file is there and everything seems to be in order.
I then run:
- gcloud auth activate-service-account --key-file=/etc/google-keys/$${GOOGLE_KEY_NAME}.json
And the result is:
ERROR: gcloud crashed (ValueError): No key could be detected.
The key is there and looks fine to me
I also tried:
- gcloud info --run-diagnostics
And got the following output:
Network diagnostic detects and fixes local network connection issues.
Checking network connection...
done.
Reachability Check passed.
Network diagnostic (1/1 checks) passed.
If I try to authenticate with the same key file on my local machine it works just fine.
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)
So either the k8s system is stopping gcloud from authenticating. Or I did something wrong when loading up my key. Or something else entirely.