Ok so adding an ssh key as a project secret seems impossible as the formatting comes out wrong and it keeps failing. Using the way described here I could at least get it to authorise if I ssh’d into the container.
Took me awhile to realise that the footprint is the string appended to the id_rsa file. In other words
“SO:ME:FIN:G:ER:PR:IN:T” becomes id_rsa_somefingerprint. Would be nice if they mentioned this in the docs. Initially looking at this file I thought it was a random string.
- add_ssh_keys:
fingerprints:
- "SO:ME:FIN:G:ER:PR:IN:T"
- run:
name: Docker build and push
command: |
docker build \
--build-arg COMMIT_REF=${CIRCLE_SHA1} \
--build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` \
--build-arg SSH_KEY="$(cat ~/.ssh/id_rsa_somefingerprint)" \
-t eu.gcr.io/${PROJECT_ID}/${PROJECT_NAME}:${CIRCLE_SHA1} .
Solution ends up looking like the above.