From 0d457183cefabbcdb9d3f31d0d10128814106a95 Mon Sep 17 00:00:00 2001 From: Jon Azpiazu Date: Tue, 14 Jan 2020 15:03:22 +0100 Subject: [PATCH] Add groovy script to enable random port for JNLP connection --- .../files/jenkins/master/enable_tcp_agents.groovy | 11 +++++++++++ modules/profile/manifests/jenkins/master.pp | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 modules/profile/files/jenkins/master/enable_tcp_agents.groovy diff --git a/modules/profile/files/jenkins/master/enable_tcp_agents.groovy b/modules/profile/files/jenkins/master/enable_tcp_agents.groovy new file mode 100644 index 00000000..9935d054 --- /dev/null +++ b/modules/profile/files/jenkins/master/enable_tcp_agents.groovy @@ -0,0 +1,11 @@ +/* Enable TCP port for inbound agents */ + +/* This script is designed to be run via jenkins-cli.jar in order to enable + * connection from agents. + */ + +import jenkins.model.Jenkins + +def instance=jenkins.model.Jenkins.instance +instance.setSlaveAgentPort(0) +instance.save() diff --git a/modules/profile/manifests/jenkins/master.pp b/modules/profile/manifests/jenkins/master.pp index 612c2cb2..970a5ad4 100644 --- a/modules/profile/manifests/jenkins/master.pp +++ b/modules/profile/manifests/jenkins/master.pp @@ -30,6 +30,14 @@ require => Service['jenkins'], } + # Enable TCP port for inbound agents + file { '/tmp/enable_tcp_agents.groovy': + source => 'puppet:///modules/profile/jenkins/master/enable_tcp_agents.groovy', + } -> + rosjenkins::groovy { '/tmp/enable_tcp_agents.groovy': + require => Service['jenkins'], + } + # config for audit-trail file { '/var/lib/jenkins/audit-trail.xml':