I have a pretty basic Jenkinsfile:
docker.image('MY_IMAGE').inside {
sh '/bin/my-command my-args'
}
This is a Pipeline script run in a Groovy sandbox. my-command
will run git clone
, and MY_IMAGE
contains ~/.ssh/id_rsa
.
This works at the moment but including id_rsa
in the image is bad security practice.
It would be better if the ssh keys (or other authentication credentials) lived in the Jenkins configuration. (It would also be ideal if known_hosts was in the Jenkins configuration, but that's a lower priority.)
I have Jenkins 2.150.1, what's the right way to set this up?