From 092d3156459e5b0028b2b7890c35880c63bd4401 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Wed, 11 Jul 2018 14:14:59 -0400 Subject: [PATCH] Add support for JNLP based minions Issue: RELENG-939 Change-Id: I05a4fa92387425932bbc28cadadbb44acbc190bb Signed-off-by: Thanh Ha --- docs/jjb/lf-ci-jobs.rst | 2 ++ shell/jenkins-configure-clouds.sh | 24 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/jjb/lf-ci-jobs.rst b/docs/jjb/lf-ci-jobs.rst index 1ce98591..d7d4b03b 100644 --- a/docs/jjb/lf-ci-jobs.rst +++ b/docs/jjb/lf-ci-jobs.rst @@ -298,6 +298,8 @@ configuration in the format ``KEY=value``. :RETENTION_TIME: Number of minutes to wait for an idle slave to be used again before it's removed. If set to -1, the slave will be kept forever. (default: 0) + :CONNECTION_TYPE: The connection type for Jenkins to connect to the build + minion. Valid options: JNLP, SSH. (default: "SSH") For a live example see the OpenDaylight project jenkins-config directory. https://github.com/opendaylight/releng-builder/tree/master/jenkins-config diff --git a/shell/jenkins-configure-clouds.sh b/shell/jenkins-configure-clouds.sh index 336c7210..3b8312e3 100644 --- a/shell/jenkins-configure-clouds.sh +++ b/shell/jenkins-configure-clouds.sh @@ -102,6 +102,24 @@ get_cloud_cfg() { echo ")" } +get_launcher_factory() { + if [ -z $1 ]; then + >&2 echo "Usage: get_launcher_factory JNLP|SSH" + exit 1 + fi + + local connection_type="$1" + + if [ "$connection_type" == "JNLP" ]; then + echo "new LauncherFactory.JNLP()" + elif [ "$connection_type" == "SSH" ]; then + echo "new LauncherFactory.SSH(\"$key_pair_name\", \"\")" + else + >&2 echo "Unknown connection type $connection_type" + exit 1 + fi +} + get_minion_options() { if [ -z $1 ]; then >&2 echo "Usage: get_minion_options CFG_FILE" @@ -166,6 +184,8 @@ get_minion_options() { jvm_options=$(get_cfg "$cfg_file" JVM_OPTIONS "") fs_root=$(get_cfg "$cfg_file" FS_ROOT "/w") retention_time=$(get_cfg "$cfg_file" RETENTION_TIME "0") + connection_type=$(get_cfg "$cfg_file" CONNECTION_TYPE "SSH") + launcher_factory=$(get_launcher_factory "$connection_type") OS_PLUGIN_VER="$(lftools jenkins plugins list \ | grep -i 'OpenStack Cloud Plugin' | awk -F':' '{print $2}')" @@ -188,7 +208,7 @@ get_minion_options() { echo " $num_executors," echo " \"$jvm_options\"," echo " \"$fs_root\"," - echo " new LauncherFactory.SSH(\"$key_pair_name\", \"\")," + echo " $launcher_factory," echo " $retention_time" else # SlaveOptions() structure for versions <= 2.34 @@ -209,7 +229,7 @@ get_minion_options() { echo " $num_executors," echo " \"$jvm_options\"," echo " \"$fs_root\"," - echo " new LauncherFactory.SSH(\"$key_pair_name\", \"\")," + echo " $launcher_factory," echo " $retention_time" fi } -- 2.16.6