Connect jenkins slave via docker network on swarm

Update jenkins location url for that case only

Change-Id: Icc74e24a4a4343ba32ca3bd7e2c15e9ea0e5ca6c
Related-prod: PROD:26834
diff --git a/docker/swarm/stack/jenkins/master.yml b/docker/swarm/stack/jenkins/master.yml
index 6af8d3e..ab850c0 100644
--- a/docker/swarm/stack/jenkins/master.yml
+++ b/docker/swarm/stack/jenkins/master.yml
@@ -31,3 +31,8 @@
               volumes:
                 - /srv/volumes/jenkins:/var/jenkins_home
                 - /etc/ssl/certs/java/cacerts:/etc/ssl/certs/java/cacerts:ro
+  # This is required only for deployments in swarm
+  jenkins:
+    client:
+      location:
+        url: http://jenkins_master:8080
diff --git a/docker/swarm/stack/jenkins/slave01.yml b/docker/swarm/stack/jenkins/slave01.yml
index f616d89..a9643ac 100644
--- a/docker/swarm/stack/jenkins/slave01.yml
+++ b/docker/swarm/stack/jenkins/slave01.yml
@@ -1,5 +1,4 @@
 classes:
-- system.docker
 - system.docker.swarm.stack.jenkins.slave_base
 parameters:
   _param:
@@ -14,12 +13,12 @@
                 JENKINS_URL: ${_param:jenkins_master_url}
                 JENKINS_AGENT_NAME: slave01
                 JENKINS_UPDATE_SLAVE: 'true'
-                JENKINS_LOGIN: ${_param:jenkins_slave_user}
-                JENKINS_PASSWORD: ${_param:jenkins_slave_password}
-                JAVA_OPTS: ${_param:jenkins_slave_extra_opts}
+                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: ${_param:docker_no_proxy}
+                no_proxy: "jenkins_master,${_param:docker_no_proxy}"
               deploy:
                 restart_policy:
                   condition: any
diff --git a/docker/swarm/stack/jenkins/slave02.yml b/docker/swarm/stack/jenkins/slave02.yml
index cbece06..fb3e6cc 100644
--- a/docker/swarm/stack/jenkins/slave02.yml
+++ b/docker/swarm/stack/jenkins/slave02.yml
@@ -1,5 +1,4 @@
 classes:
-- system.docker
 - system.docker.swarm.stack.jenkins.slave_base
 parameters:
   _param:
@@ -14,12 +13,12 @@
                 JENKINS_URL: ${_param:jenkins_master_url}
                 JENKINS_AGENT_NAME: slave02
                 JENKINS_UPDATE_SLAVE: 'true'
-                JENKINS_LOGIN: ${_param:jenkins_slave_user}
-                JENKINS_PASSWORD: ${_param:jenkins_slave_password}
-                JAVA_OPTS: ${_param:jenkins_slave_extra_opts}
+                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: ${_param:docker_no_proxy}
+                no_proxy: "jenkins_master,${_param:docker_no_proxy}"
               deploy:
                 restart_policy:
                   condition: any
diff --git a/docker/swarm/stack/jenkins/slave03.yml b/docker/swarm/stack/jenkins/slave03.yml
index 6ff900c..b10dc66 100644
--- a/docker/swarm/stack/jenkins/slave03.yml
+++ b/docker/swarm/stack/jenkins/slave03.yml
@@ -1,5 +1,4 @@
 classes:
-- system.docker
 - system.docker.swarm.stack.jenkins.slave_base
 parameters:
   _param:
@@ -14,12 +13,12 @@
                 JENKINS_URL: ${_param:jenkins_master_url}
                 JENKINS_AGENT_NAME: slave03
                 JENKINS_UPDATE_SLAVE: 'true'
-                JENKINS_LOGIN: ${_param:jenkins_slave_user}
-                JENKINS_PASSWORD: ${_param:jenkins_slave_password}
-                JAVA_OPTS: ${_param:jenkins_slave_extra_opts}
+                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: ${_param:docker_no_proxy}
+                no_proxy: "jenkins_master,${_param:docker_no_proxy}"
               deploy:
                 restart_policy:
                   condition: any
diff --git a/docker/swarm/stack/jenkins/slave_base.yml b/docker/swarm/stack/jenkins/slave_base.yml
index 91601ab..3de4765 100644
--- a/docker/swarm/stack/jenkins/slave_base.yml
+++ b/docker/swarm/stack/jenkins/slave_base.yml
@@ -1,9 +1,7 @@
 classes:
+- system.docker
 - system.docker.client.images.jenkins_slave
 parameters:
   _param:
-    jenkins_master_host: ${_param:control_vip_address}
-    jenkins_master_url: http://${_param:jenkins_master_host}:${_param:jenkins_master_port}
-    jenkins_slave_user: ${_param:jenkins_client_user}
-    jenkins_slave_password: ${_param:jenkins_client_password}
+    jenkins_master_url: http://jenkins_master:8080
     jenkins_slave_extra_opts: ""