Skip to content

Commit b773234

Browse files
committed
docs: add docker-plugin SSH connector JCasC example (fixes #2739)
1 parent 2bb5808 commit b773234

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

demos/docker-plugin/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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"

0 commit comments

Comments
 (0)