From: Thanh Ha Date: Mon, 25 Jun 2018 16:37:58 +0000 (-0400) Subject: Fix empty variable when run in Jenkins X-Git-Tag: v0.21.4^0 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;ds=sidebyside;h=f58aa56acc44a8eb7498af10e5d229e1690e58b0;p=releng%2Fglobal-jjb.git Fix empty variable when run in Jenkins Change-Id: Ic6e2b1424e8e59611e021c4a506ba556e8e2111e Signed-off-by: Thanh Ha --- diff --git a/shell/jenkins-configure-clouds.sh b/shell/jenkins-configure-clouds.sh index 47e95830..00bd2d77 100644 --- a/shell/jenkins-configure-clouds.sh +++ b/shell/jenkins-configure-clouds.sh @@ -46,17 +46,6 @@ mkdir -p "$SCRIPT_DIR" silos="${jenkins_silos:-jenkins}" -set +x # Disable `set -x` to prevent printing passwords -echo "Configuring $silo" -JENKINS_URL=$(crudini --get "$HOME"/.config/jenkins_jobs/jenkins_jobs.ini "$silo" url) -JENKINS_USER=$(crudini --get "$HOME"/.config/jenkins_jobs/jenkins_jobs.ini "$silo" user) -JENKINS_PASSWORD=$(crudini --get "$HOME"/.config/jenkins_jobs/jenkins_jobs.ini "$silo" password) -export JENKINS_URL -export JENKINS_USER -export JENKINS_PASSWORD -OS_PLUGIN_VER="$(lftools jenkins plugins list \ - | grep 'Openstack Cloud Plugin' | awk -F':' '{print $2}')" - set -eu -o pipefail version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; } @@ -178,6 +167,8 @@ get_minion_options() { fs_root=$(get_cfg "$cfg_file" FS_ROOT "/w") retention_time=$(get_cfg "$cfg_file" RETENTION_TIME "0") + OS_PLUGIN_VER="$(lftools jenkins plugins list \ + | grep 'Openstack Cloud Plugin' | awk -F':' '{print $2}')" if version_ge "$OS_PLUGIN_VER" "2.35"; then if [ ! -z "$volume_size" ]; then echo " new BootSource.VolumeFromImage(\"$image_name\", $volume_size)," @@ -264,6 +255,15 @@ for silo in $silos; do node_prefix="${silo}-" fi + set +x # Disable `set -x` to prevent printing passwords + echo "Configuring $silo" + JENKINS_URL=$(crudini --get "$HOME"/.config/jenkins_jobs/jenkins_jobs.ini "$silo" url) + JENKINS_USER=$(crudini --get "$HOME"/.config/jenkins_jobs/jenkins_jobs.ini "$silo" user) + JENKINS_PASSWORD=$(crudini --get "$HOME"/.config/jenkins_jobs/jenkins_jobs.ini "$silo" password) + export JENKINS_URL + export JENKINS_USER + export JENKINS_PASSWORD + echo "-----> Groovy script $script_file" for cloud in "${clouds[@]}"; do cfg_dir="${cloud}"