X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fjenkins-configure-clouds.sh;h=0b30c59b5d0bc7460b30731dfd06826b4b04bd6c;hb=refs%2Fchanges%2F74%2F11774%2F1;hp=336c7210bd7b6f71e20dce7b24a5184e18b69005;hpb=00c63a2333388cc9a557bb84decce4dc0782cb83;p=releng%2Fglobal-jjb.git diff --git a/shell/jenkins-configure-clouds.sh b/shell/jenkins-configure-clouds.sh index 336c7210..0b30c59b 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" @@ -161,11 +179,16 @@ get_minion_options() { security_groups=$(get_cfg "$cfg_file" SECURITY_GROUPS "default") availability_zone=$(get_cfg "$cfg_file" AVAILABILITY_ZONE "") start_timeout=$(get_cfg "$cfg_file" START_TIMEOUT "600000") - key_pair_name=$(get_cfg "$cfg_file" KEY_PAIR_NAME "jenkins-ssh") + + kpn_default="$(get_cfg "$(dirname $cfg_file)/cloud.cfg" KEY_PAIR_NAME "jenkins-ssh")" + key_pair_name=$(get_cfg "$cfg_file" KEY_PAIR_NAME "$kpn_default") + num_executors=$(get_cfg "$cfg_file" NUM_EXECUTORS "1") 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 +211,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 +232,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 }