I have a CI system set up using the stable Jenkins Helm chart with the BlueOcean plugin.
In my SCM system (BitBucket Server), I have a Jenkins build user created with SSH keys configured.
What I'd like to do is bootstrap the Jenkins install with the SSH key so that when configuring a BlueOcean pipeline, authentication is handled seamlessly. As it is, I have to go in to the repository I want to build and add access for the SSH key generated by BlueOcean. This is obviously not ideal as it adds an additional manual step for each build pipeline to be configured.
The Jenkins Helm chart documentation specifies an Agent.volumes
value in values.yaml
that can be used to mount, for instance, a Kubernetes secret containing the SSH keys. However, this is agent configuration, so presumably would allow for SCM authentication from a build agent (e.g., from a Jenkinsfile). What I want to do is bootstrap the keys into Jenkins master.
I see that there is a Master.CredentialsXmlSecret
which allows for a Kubernetes secret containing a Credentials XML file, but the documentation on this is sparse (or non-existent).
Has anyone set up Jenkins on Kubernetes/Helm with this kind of SSH configuration?
*Edit: So I have managed to produce a correct credentials.xml
file by logging in to Jenkins and manually setting up the SSH keys, then copying the produced credentials.xml
file, running it through base64
encoding, adding it as a Kubernetes secret and then binding it to Master.CredentialsXmlSecret
in the Jenkins Helm chart's values.yaml
. After doing that, my Jenkins instance loads up with the credentials.xml
file in place (/var/jenkins_home/credentials.xml
). The Credentials don't appear to be loading into the Jenkins UI correctly but I think I'm on the right track.
/var/jenkins_home/credentials.xml
file, running it throughbase64
encoding, storing it as a Kubernetes secret, and then mounting that secret to theMaster.CredentialsXmlSecret
property invalues.yaml
. – LiquidPony