Add support for ssh jenkins slaves
PROD-29680
Change-Id: I1e2154ba311f2c0f689a472227979e6946fb7e8b
diff --git a/docker/client/images/cicd.yml b/docker/client/images/cicd.yml
index 895bde3..003b131 100644
--- a/docker/client/images/cicd.yml
+++ b/docker/client/images/cicd.yml
@@ -1,6 +1,3 @@
-classes:
-- system.docker.client.images.jenkins_master
-- system.docker.client.images.jenkins_slave
parameters:
docker:
client:
diff --git a/docker/client/images/jenkins_master.yml b/docker/client/images/jenkins_master.yml
index 929c76e..d74bb20 100644
--- a/docker/client/images/jenkins_master.yml
+++ b/docker/client/images/jenkins_master.yml
@@ -1,6 +1 @@
-parameters:
- docker:
- client:
- enabled: true
- images:
- - ${_param:docker_image_jenkins}
\ No newline at end of file
+# Left for providing upgrade path
diff --git a/docker/client/images/jenkins_slave.yml b/docker/client/images/jenkins_slave.yml
index 46114d4..d74bb20 100644
--- a/docker/client/images/jenkins_slave.yml
+++ b/docker/client/images/jenkins_slave.yml
@@ -1,6 +1 @@
-parameters:
- docker:
- client:
- enabled: true
- images:
- - ${_param:docker_image_jenkins_slave}
+# Left for providing upgrade path
diff --git a/docker/swarm/stack/jenkins/jnlp_slave_multi.yml b/docker/swarm/stack/jenkins/jnlp_slave_multi.yml
new file mode 100644
index 0000000..5246cb7
--- /dev/null
+++ b/docker/swarm/stack/jenkins/jnlp_slave_multi.yml
@@ -0,0 +1,59 @@
+classes:
+- system.docker.swarm.stack.jenkins.jnlp_slave_single
+parameters:
+ _param:
+ jenkins_slave02_node_name: ${_param:cluster_node02_name}
+ jenkins_slave03_node_name: ${_param:cluster_node03_name}
+ docker:
+ client:
+ stack:
+ jenkins:
+ service:
+ slave02:
+ environment:
+ JENKINS_URL: ${_param:jenkins_master_url}
+ JENKINS_AGENT_NAME: slave02
+ JENKINS_UPDATE_SLAVE: 'true'
+ JENKINS_LOGIN: ${_param:jenkins_client_user}
+ JENKINS_PASSWORD: ${_param:jenkins_client_password}
+ JAVA_OPTS: "-Dhttp.proxyHost=${_param:docker_http_proxy} -Dhttp.nonProxyHosts=|jenkins_master ${_param:jenkins_slave_extra_opts}"
+ https_proxy: ${_param:docker_https_proxy}
+ http_proxy: ${_param:docker_http_proxy}
+ no_proxy: "jenkins_master,${_param:docker_no_proxy}"
+ deploy:
+ restart_policy:
+ condition: any
+ placement:
+ constraints:
+ - "node.hostname == ${_param:jenkins_slave02_node_name}"
+ image: ${_param:docker_image_jenkins_jnlp_slave}
+ volumes:
+ - /etc/ssl/certs/:/etc/ssl/certs/:ro
+ - /dev/urandom:/dev/random:ro
+ - /var/run/docker.sock:/var/run/docker.sock
+ - /usr/bin/docker:/usr/bin/docker:ro
+ - /var/lib/jenkins:/var/lib/jenkins
+ slave03:
+ environment:
+ JENKINS_URL: ${_param:jenkins_master_url}
+ JENKINS_AGENT_NAME: slave03
+ JENKINS_UPDATE_SLAVE: 'true'
+ JENKINS_LOGIN: ${_param:jenkins_client_user}
+ JENKINS_PASSWORD: ${_param:jenkins_client_password}
+ JAVA_OPTS: "-Dhttp.proxyHost=${_param:docker_http_proxy} -Dhttp.nonProxyHosts=|jenkins_master ${_param:jenkins_slave_extra_opts}"
+ https_proxy: ${_param:docker_https_proxy}
+ http_proxy: ${_param:docker_http_proxy}
+ no_proxy: "jenkins_master,${_param:docker_no_proxy}"
+ deploy:
+ restart_policy:
+ condition: any
+ placement:
+ constraints:
+ - "node.hostname == ${_param:jenkins_slave03_node_name}"
+ image: ${_param:docker_image_jenkins_jnlp_slave}
+ volumes:
+ - /etc/ssl/certs/:/etc/ssl/certs/:ro
+ - /dev/urandom:/dev/random:ro
+ - /var/run/docker.sock:/var/run/docker.sock
+ - /usr/bin/docker:/usr/bin/docker:ro
+ - /var/lib/jenkins:/var/lib/jenkins
diff --git a/docker/swarm/stack/jenkins/slave01.yml b/docker/swarm/stack/jenkins/jnlp_slave_single.yml
similarity index 83%
rename from docker/swarm/stack/jenkins/slave01.yml
rename to docker/swarm/stack/jenkins/jnlp_slave_single.yml
index 73e8140..8b05c47 100644
--- a/docker/swarm/stack/jenkins/slave01.yml
+++ b/docker/swarm/stack/jenkins/jnlp_slave_single.yml
@@ -1,10 +1,15 @@
classes:
-- system.docker.swarm.stack.jenkins.slave_base
+- system.docker
parameters:
_param:
+ jenkins_master_url: http://jenkins_master:8080
+ jenkins_slave_extra_opts: ""
jenkins_slave01_node_name: ${_param:cluster_node01_name}
docker:
client:
+ enabled: true
+ images:
+ - ${_param:docker_image_jenkins_jnlp_slave}
stack:
jenkins:
service:
@@ -25,7 +30,7 @@
placement:
constraints:
- "node.hostname == ${_param:jenkins_slave01_node_name}"
- image: ${_param:docker_image_jenkins_slave}
+ image: ${_param:docker_image_jenkins_jnlp_slave}
volumes:
- /etc/ssl/certs/:/etc/ssl/certs/:ro
- /dev/urandom:/dev/random:ro
diff --git a/docker/swarm/stack/jenkins/master.yml b/docker/swarm/stack/jenkins/master.yml
index 4647521..921f111 100644
--- a/docker/swarm/stack/jenkins/master.yml
+++ b/docker/swarm/stack/jenkins/master.yml
@@ -1,6 +1,5 @@
classes:
- system.docker
-- system.docker.client.images.jenkins_master
parameters:
_param:
jenkins_master_extra_opts: ""
@@ -9,6 +8,9 @@
jenkins_home_dir_path: /var/jenkins_home
docker:
client:
+ enabled: true
+ images:
+ - ${_param:docker_image_jenkins}
stack:
jenkins:
service:
diff --git a/docker/swarm/stack/jenkins/slave.yml b/docker/swarm/stack/jenkins/slave.yml
index 204b29d..4454c5a 100644
--- a/docker/swarm/stack/jenkins/slave.yml
+++ b/docker/swarm/stack/jenkins/slave.yml
@@ -1,5 +1,3 @@
+# jnlp slave
classes:
-- system.docker
-- system.docker.swarm.stack.jenkins.slave01
-- system.docker.swarm.stack.jenkins.slave02
-- system.docker.swarm.stack.jenkins.slave03
+- system.docker.swarm.stack.jenkins.jnlp_slave_multi
diff --git a/docker/swarm/stack/jenkins/slave02.yml b/docker/swarm/stack/jenkins/slave02.yml
deleted file mode 100644
index ee198cb..0000000
--- a/docker/swarm/stack/jenkins/slave02.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-classes:
-- system.docker.swarm.stack.jenkins.slave_base
-parameters:
- _param:
- jenkins_slave02_node_name: ${_param:cluster_node02_name}
- docker:
- client:
- stack:
- jenkins:
- service:
- slave02:
- environment:
- JENKINS_URL: ${_param:jenkins_master_url}
- JENKINS_AGENT_NAME: slave02
- JENKINS_UPDATE_SLAVE: 'true'
- JENKINS_LOGIN: ${_param:jenkins_client_user}
- JENKINS_PASSWORD: ${_param:jenkins_client_password}
- JAVA_OPTS: "-Dhttp.proxyHost=${_param:docker_http_proxy} -Dhttp.nonProxyHosts=|jenkins_master ${_param:jenkins_slave_extra_opts}"
- https_proxy: ${_param:docker_https_proxy}
- http_proxy: ${_param:docker_http_proxy}
- no_proxy: "jenkins_master,${_param:docker_no_proxy}"
- deploy:
- restart_policy:
- condition: any
- placement:
- constraints:
- - "node.hostname == ${_param:jenkins_slave02_node_name}"
- image: ${_param:docker_image_jenkins_slave}
- volumes:
- - /etc/ssl/certs/:/etc/ssl/certs/:ro
- - /dev/urandom:/dev/random:ro
- - /var/run/docker.sock:/var/run/docker.sock
- - /usr/bin/docker:/usr/bin/docker:ro
- - /var/lib/jenkins:/var/lib/jenkins
diff --git a/docker/swarm/stack/jenkins/slave03.yml b/docker/swarm/stack/jenkins/slave03.yml
deleted file mode 100644
index b04ea2a..0000000
--- a/docker/swarm/stack/jenkins/slave03.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-classes:
-- system.docker.swarm.stack.jenkins.slave_base
-parameters:
- _param:
- jenkins_slave03_node_name: ${_param:cluster_node03_name}
- docker:
- client:
- stack:
- jenkins:
- service:
- slave03:
- environment:
- JENKINS_URL: ${_param:jenkins_master_url}
- JENKINS_AGENT_NAME: slave03
- JENKINS_UPDATE_SLAVE: 'true'
- JENKINS_LOGIN: ${_param:jenkins_client_user}
- JENKINS_PASSWORD: ${_param:jenkins_client_password}
- JAVA_OPTS: "-Dhttp.proxyHost=${_param:docker_http_proxy} -Dhttp.nonProxyHosts=|jenkins_master ${_param:jenkins_slave_extra_opts}"
- https_proxy: ${_param:docker_https_proxy}
- http_proxy: ${_param:docker_http_proxy}
- no_proxy: "jenkins_master,${_param:docker_no_proxy}"
- deploy:
- restart_policy:
- condition: any
- placement:
- constraints:
- - "node.hostname == ${_param:jenkins_slave03_node_name}"
- image: ${_param:docker_image_jenkins_slave}
- volumes:
- - /etc/ssl/certs/:/etc/ssl/certs/:ro
- - /dev/urandom:/dev/random:ro
- - /var/run/docker.sock:/var/run/docker.sock
- - /usr/bin/docker:/usr/bin/docker:ro
- - /var/lib/jenkins:/var/lib/jenkins
diff --git a/docker/swarm/stack/jenkins/slave_base.yml b/docker/swarm/stack/jenkins/slave_base.yml
deleted file mode 100644
index 3de4765..0000000
--- a/docker/swarm/stack/jenkins/slave_base.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-classes:
-- system.docker
-- system.docker.client.images.jenkins_slave
-parameters:
- _param:
- jenkins_master_url: http://jenkins_master:8080
- jenkins_slave_extra_opts: ""
diff --git a/docker/swarm/stack/jenkins/slave_single.yml b/docker/swarm/stack/jenkins/slave_single.yml
index 31406d1..ee2bfac 100644
--- a/docker/swarm/stack/jenkins/slave_single.yml
+++ b/docker/swarm/stack/jenkins/slave_single.yml
@@ -1,3 +1,3 @@
+# Left for providing upgrade path
classes:
-- system.docker
-- system.docker.swarm.stack.jenkins.slave01
+- system.docker.swarm.stack.jenkins.jnlp_slave_single
diff --git a/docker/swarm/stack/jenkins/ssh_slave_multi.yml b/docker/swarm/stack/jenkins/ssh_slave_multi.yml
new file mode 100644
index 0000000..2959e4d
--- /dev/null
+++ b/docker/swarm/stack/jenkins/ssh_slave_multi.yml
@@ -0,0 +1,66 @@
+classes:
+- system.docker.swarm.stack.jenkins.ssh_slave_single
+parameters:
+ _param:
+ jenkins_slave02_node_name: ${_param:cluster_node02_name}
+ jenkins_slave03_node_name: ${_param:cluster_node03_name}
+ docker:
+ client:
+ stack:
+ jenkins:
+ service:
+ slave02:
+ environment:
+ JENKINS_SLAVE_SSH_PUBKEY: ${_param:jenkins_admin_public_key}
+ https_proxy: ${_param:docker_https_proxy}
+ http_proxy: ${_param:docker_http_proxy}
+ no_proxy: "jenkins_master,${_param:docker_no_proxy}"
+ deploy:
+ restart_policy:
+ condition: any
+ placement:
+ constraints:
+ - "node.hostname == ${_param:jenkins_slave02_node_name}"
+ image: ${_param:docker_image_jenkins_ssh_slave}
+ volumes:
+ - /etc/ssl/certs/:/etc/ssl/certs/:ro
+ - /dev/urandom:/dev/random:ro
+ - /var/run/docker.sock:/var/run/docker.sock
+ - /usr/bin/docker:/usr/bin/docker:ro
+ - /var/lib/jenkins:/var/lib/jenkins
+ slave03:
+ environment:
+ JENKINS_SLAVE_SSH_PUBKEY: ${_param:jenkins_admin_public_key}
+ https_proxy: ${_param:docker_https_proxy}
+ http_proxy: ${_param:docker_http_proxy}
+ no_proxy: "jenkins_master,${_param:docker_no_proxy}"
+ deploy:
+ restart_policy:
+ condition: any
+ placement:
+ constraints:
+ - "node.hostname == ${_param:jenkins_slave03_node_name}"
+ image: ${_param:docker_image_jenkins_ssh_slave}
+ volumes:
+ - /etc/ssl/certs/:/etc/ssl/certs/:ro
+ - /dev/urandom:/dev/random:ro
+ - /var/run/docker.sock:/var/run/docker.sock
+ - /usr/bin/docker:/usr/bin/docker:ro
+ - /var/lib/jenkins:/var/lib/jenkins
+ jenkins:
+ client:
+ node:
+ slave02:
+ launcher:
+ type: ssh
+ host: jenkins_slave02
+ port: 22
+ username: jenkins
+ credentials: ssh_slave
+ slave03:
+ launcher:
+ type: ssh
+ host: jenkins_slave03
+ port: 22
+ username: jenkins
+ credentials: ssh_slave
diff --git a/docker/swarm/stack/jenkins/ssh_slave_single.yml b/docker/swarm/stack/jenkins/ssh_slave_single.yml
new file mode 100644
index 0000000..dbdaf1d
--- /dev/null
+++ b/docker/swarm/stack/jenkins/ssh_slave_single.yml
@@ -0,0 +1,47 @@
+classes:
+- system.docker
+parameters:
+ _param:
+ jenkins_slave01_node_name: ${_param:cluster_node01_name}
+ docker:
+ client:
+ enabled: true
+ images:
+ - ${_param:docker_image_jenkins_ssh_slave}
+ stack:
+ jenkins:
+ service:
+ slave01:
+ environment:
+ JENKINS_SLAVE_SSH_PUBKEY: ${_param:jenkins_admin_public_key}
+ https_proxy: ${_param:docker_https_proxy}
+ http_proxy: ${_param:docker_http_proxy}
+ no_proxy: "jenkins_master,${_param:docker_no_proxy}"
+ deploy:
+ restart_policy:
+ condition: any
+ placement:
+ constraints:
+ - "node.hostname == ${_param:jenkins_slave01_node_name}"
+ image: ${_param:docker_image_jenkins_ssh_slave}
+ volumes:
+ - /etc/ssl/certs/:/etc/ssl/certs/:ro
+ - /dev/urandom:/dev/random:ro
+ - /var/run/docker.sock:/var/run/docker.sock
+ - /usr/bin/docker:/usr/bin/docker:ro
+ - /var/lib/jenkins:/var/lib/jenkins
+ jenkins:
+ client:
+ node:
+ slave01:
+ launcher:
+ type: ssh
+ host: jenkins_slave01
+ port: 22
+ username: jenkins
+ credentials: ssh_slave
+ credential:
+ ssh_slave:
+ username: jenkins
+ key: ${_param:jenkins_admin_private_key}
+