File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Docker Plugin — SSH Connector JCasC Demo
2+
3+ This demo provides a working Jenkins Configuration as Code (JCasC) example for configuring
4+ the Docker plugin with the SSH connector. The existing documentation does not show how to
5+ set up SSH-based agents using the docker-plugin, so this example is added to fill that gap.
6+
7+ ## SSH connector usage
8+
9+ The docker-plugin exposes the ` sshConnector ` field for configuring SSH-based cloud agents.
10+ Using other keys such as ` ssh: ` does not match the expected structure and will cause a
11+ configuration error.
12+
13+ A working configuration can be found in ` docker-plugin-ssh.yaml ` . The key part of the
14+ connector configuration is:
15+
16+ ``` yaml
17+ connector :
18+ sshConnector :
19+ sshKeyCredentialsId : " my-ssh-key-id"
20+ javaPath : " /opt/java/openjdk/bin/java"
Original file line number Diff line number Diff line change 1+ # demos/docker-plugin/docker-plugin-ssh.yaml
2+ jenkins :
3+ clouds :
4+ - docker :
5+ name : " my-docker-cloud"
6+ dockerHost :
7+ uri : " unix:///var/run/docker.sock"
8+ templates :
9+ - labelString : " worker1-agent"
10+ dockerTemplateBase :
11+ image : " jenkins/ssh-agent:latest-jdk17"
12+ mounts :
13+ - " type=tmpfs,destination=/run"
14+ - " type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock"
15+
16+ remoteFs : " /home/jenkins/agent"
17+ connector :
18+ sshConnector :
19+ sshKeyCredentialsId : " my-ssh-key-id"
20+ javaPath : " /opt/java/openjdk/bin/java"
You can’t perform that action at this time.
0 commit comments