diff --git a/config/devstack/micro-osd.sh b/config/devstack/micro-osd.sh index 65657b46..85a6d04a 100644 --- a/config/devstack/micro-osd.sh +++ b/config/devstack/micro-osd.sh @@ -1,3 +1,4 @@ +#!/bin/bash -xe # # Copyright (C) 2013,2014 Loic Dachary # @@ -36,7 +37,7 @@ DIR=$1 if ! dpkg -l ceph ; then wget -q -O- 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc' | sudo apt-key add - - echo deb http://ceph.com/debian-dumpling/ $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph.list + echo deb http://ceph.com/debian-dumpling/ "$(lsb_release -sc)" main | sudo tee /etc/apt/sources.list.d/ceph.list fi sudo apt-get update sudo apt-get --yes install ceph ceph-common @@ -45,9 +46,9 @@ sudo apt-get --yes install ceph ceph-common pkill ceph-mon || true pkill ceph-osd || true if $old; then - rm -rf $DIR/* + rm -rf "${DIR:?}/"* else - rm -rf $DIR + rm -rf "${DIR}" fi # cluster wide parameters diff --git a/slave-scripts/dib.sh b/slave-scripts/dib.sh index 50dd16ea..9aa95c7d 100755 --- a/slave-scripts/dib.sh +++ b/slave-scripts/dib.sh @@ -13,7 +13,7 @@ SAHARA_PATH="/tmp/sahara" SAHARA_TESTS_PATH="/tmp/sahara-tests" sahara_conf_file="$SAHARA_PATH/etc/sahara/sahara.conf" sahara_templates_path=$SAHARA_TESTS_PATH/sahara_tests/scenario/defaults -tests_etc=$sahara_templates_path +export tests_etc=$sahara_templates_path plugin="$1" os="$2" @@ -52,85 +52,85 @@ esac case $plugin in vanilla_2.7.1) - env ${os_type}_vanilla_hadoop_2_7_1_image_name=${vanilla_2_7_1_image} SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p vanilla -i $os_type -v 2.7.1 - check_error_code $? ${vanilla_2_7_1_image}.qcow2 - upload_image "${plugin}" "${username}" ${vanilla_2_7_1_image} + env ${os_type}_vanilla_hadoop_2_7_1_image_name="${vanilla_2_7_1_image:?}" SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p vanilla -i $os_type -v 2.7.1 + check_error_code $? "${vanilla_2_7_1_image:?}".qcow2 + upload_image "${plugin}" "${username}" "${vanilla_2_7_1_image:?}" mode=distribute scenario_conf_file="$sahara_templates_path/vanilla-2.7.1.yaml.mako" template_image_prefix="vanilla_two_seven_one" ;; spark_1.3.1) - env ubuntu_spark_image_name=${spark_1_3_1_image} SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p spark -s 1.3.1 - check_error_code $? ${spark_1_3_1_image}.qcow2 - upload_image "${plugin}" "${username}" ${spark_1_3_1_image} + env ubuntu_spark_image_name="${spark_1_3_1_image:?}" SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p spark -s 1.3.1 + check_error_code $? "${spark_1_3_1_image:?}".qcow2 + upload_image "${plugin}" "${username}" "${spark_1_3_1_image:?}" scenario_conf_file="$sahara_templates_path/spark-1.3.1.yaml.mako" template_image_prefix="spark_1_3" ;; spark_1.6.0) - env ubuntu_spark_image_name=${spark_1_6_0_image} SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p spark -s 1.6.0 - check_error_code $? ${spark_1_6_0_image}.qcow2 - upload_image "${plugin}" "${username}" ${spark_1_6_0_image} + env ubuntu_spark_image_name="${spark_1_6_0_image:?}" SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p spark -s 1.6.0 + check_error_code $? "${spark_1_6_0_image:?}".qcow2 + upload_image "${plugin}" "${username}" "${spark_1_6_0_image:?}" scenario_conf_file="$sahara_templates_path/spark-1.6.0.yaml.mako" template_image_prefix="spark_1_6" ;; cdh_5.4.0) - env cloudera_5_4_${os_type}_image_name=${cdh_5_4_0_image} SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p cloudera -i $os_type -v 5.4 - check_error_code $? ${cdh_5_4_0_image}.qcow2 - upload_image "${plugin}" "${username}" ${cdh_5_4_0_image} + env cloudera_5_4_${os_type}_image_name="${cdh_5_4_0_image:?}" SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p cloudera -i $os_type -v 5.4 + check_error_code $? "${cdh_5_4_0_image:?}".qcow2 + upload_image "${plugin}" "${username}" "${cdh_5_4_0_image:?}" scenario_conf_file="$sahara_templates_path/cdh-5.4.0.yaml.mako" template_image_prefix="cdh_5_4_0" ;; cdh_5.5.0) - env cloudera_5_5_${os_type}_image_name=${cdh_5_5_0_image} SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p cloudera -i $os_type -v 5.5 - check_error_code $? ${cdh_5_5_0_image}.qcow2 - upload_image "${plugin}" "${username}" ${cdh_5_5_0_image} + env cloudera_5_5_${os_type}_image_name="${cdh_5_5_0_image:?}" SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p cloudera -i $os_type -v 5.5 + check_error_code $? "${cdh_5_5_0_image:?}".qcow2 + upload_image "${plugin}" "${username}" "${cdh_5_5_0_image:?}" scenario_conf_file="$sahara_templates_path/cdh-5.5.0.yaml.mako" template_image_prefix="cdh_5_5_0" ;; cdh_5.7.0) - env cloudera_5_7_${os_type}_image_name=${cdh_5_7_0_image} SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p cloudera -i $os_type -v 5.7 - check_error_code $? ${cdh_5_7_0_image}.qcow2 - upload_image "${plugin}" "${username}" ${cdh_5_7_0_image} + env cloudera_5_7_${os_type}_image_name="${cdh_5_7_0_image:?}" SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p cloudera -i $os_type -v 5.7 + check_error_code $? "${cdh_5_7_0_image:?}".qcow2 + upload_image "${plugin}" "${username}" "${cdh_5_7_0_image:?}" scenario_conf_file="$sahara_templates_path/cdh-5.7.0.yaml.mako" template_image_prefix="cdh_5_7_0" ;; ambari_2.2) - env ambari_${os_type}_image_name=${ambari_2_2_image} SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p ambari -i $os_type - check_error_code $? ${ambari_2_2_image}.qcow2 - upload_image "${plugin}" "${username}" ${ambari_2_2_image} + env ambari_${os_type}_image_name="${ambari_2_2_image:?}" SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p ambari -i $os_type + check_error_code $? "${ambari_2_2_image:?}".qcow2 + upload_image "${plugin}" "${username}" "${ambari_2_2_image:?}" # we use Ambari 2.1 management console for creating HDP 2.3 stack scenario_conf_file="$sahara_templates_path/ambari-2.3.yaml.mako" template_image_prefix="ambari_2_2" ;; mapr_5.1.0.mrv2) - env mapr_ubuntu_image_name=${mapr_5_1_0_mrv2_image} SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p mapr -i ubuntu -r 5.1.0 - check_error_code $? ${mapr_5_1_0_mrv2_image}.qcow2 - upload_image "${plugin}" "${username}" ${mapr_5_1_0_mrv2_image} + env mapr_ubuntu_image_name="${mapr_5_1_0_mrv2_image:?}" SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p mapr -i ubuntu -r 5.1.0 + check_error_code $? "${mapr_5_1_0_mrv2_image:?}".qcow2 + upload_image "${plugin}" "${username}" "${mapr_5_1_0_mrv2_image:?}" mode=distribute scenario_conf_file="$sahara_templates_path/mapr-5.1.0.mrv2.yaml.mako" template_image_prefix="mapr_510mrv2" ;; mapr_5.2.0.mrv2) - env mapr_ubuntu_image_name=${mapr_5_2_0_mrv2_image} SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p mapr -i ubuntu -r 5.2.0 - check_error_code $? ${mapr_5_2_0_mrv2_image}.qcow2 - upload_image "${plugin}" "${username}" ${mapr_5_2_0_mrv2_image} + env mapr_ubuntu_image_name="${mapr_5_2_0_mrv2_image:?}" SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p mapr -i ubuntu -r 5.2.0 + check_error_code $? "${mapr_5_2_0_mrv2_image:?}".qcow2 + upload_image "${plugin}" "${username}" "${mapr_5_2_0_mrv2_image:?}" mode=distribute scenario_conf_file="$sahara_templates_path/mapr-5.2.0.mrv2.yaml.mako" template_image_prefix="mapr_520mrv2" ;; storm_1.0.1) - env ubuntu_storm_image_name=${storm_1_0_1_image} SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p storm -t 1.0.1 - check_error_code $? ${storm_1_0_1_image}.qcow2 - upload_image "${plugin}" "${username}" ${storm_1_0_1_image} + env ubuntu_storm_image_name="${storm_1_0_1_image:?}" SIM_REPO_PATH=$WORKSPACE tox -e venv -- sahara-image-create -p storm -t 1.0.1 + check_error_code $? "${storm_1_0_1_image:?}".qcow2 + upload_image "${plugin}" "${username}" "${storm_1_0_1_image:?}" scenario_conf_file="$sahara_templates_path/storm-1.0.1.yaml.mako" template_image_prefix="storm_1_0" ;; diff --git a/slave-scripts/functions-common.sh b/slave-scripts/functions-common.sh index 79adbae9..2f50f1b8 100755 --- a/slave-scripts/functions-common.sh +++ b/slave-scripts/functions-common.sh @@ -47,7 +47,7 @@ get_dependency() { if check_dependency_patch "$project_name" then # when patch depends on patch to some project - pushd $(pwd) + pushd "$(pwd)" mkdir "$project_dir" && cd "$project_dir" ZUUL_PROJECT="$project_name" /usr/local/jenkins/slave_scripts/gerrit-git-prep.sh https://review.openstack.org https://review.openstack.org popd @@ -74,7 +74,8 @@ insert_config_value() { $option = $value " "$file" else - local sep=$(echo -ne "\x01") + local sep + sep=$(echo -ne "\x01") # Replace it sed -i -e '/^\['${section}'\]/,/^\[.*\]/ s'${sep}'^\('${option}'[ \t]*=[ \t]*\).*$'${sep}'\1'"${value}"${sep} "$file" fi @@ -93,7 +94,8 @@ insert_scenario_value() { if ! scenario_has_option "$file" "$main_key" "$stop_key" "$sub_key"; then echo "No such keys: $main_key -> $sub_key in scenario $file file. Skip setting value $value" else - local sep=$(echo -ne "\x01") + local sep + sep=$(echo -ne "\x01") sed -i -e '/'${main_key}':/,/'${stop_key}'/ s'${sep}'\([ \t]'${sub_key}':[ \t]\).*'${old_value}'.*$'${sep}'\1'${value}${sep} $file fi } @@ -106,12 +108,14 @@ print_python_env() { run_tests() { local scenario_config=$1 + # shellcheck disable=SC2034 local concurrency=${2:-"1"} echo "Integration tests are started" export PYTHONUNBUFFERED=1 - local scenario_edp="$tests_etc/edp.yaml.mako" + local scenario_edp + scenario_edp="${tests_etc:?}/edp.yaml.mako" if [ ! -f $scenario_edp ]; then - scenario_edp="$tests_etc/edp.yaml" + scenario_edp="${tests_etc:?}/edp.yaml" fi # Temporary use additional log file, due to wrong status code from tox scenario tests pushd $SAHARA_TESTS_PATH @@ -135,7 +139,8 @@ scenario_has_option() { start_sahara() { local conf_path=$1 - local conf_dir=$(dirname $1) + local conf_dir + conf_dir=$(dirname $1) local mode=$2 mkdir $WORKSPACE/logs sahara-db-manage --config-file $conf_path upgrade head || failure "Command 'sahara-db-manage' failed" @@ -180,12 +185,12 @@ write_tests_conf() { local cluster_name=$1 local image_prefix=$2 local image_name=$3 - NETWORK="neutron" + export NETWORK="neutron" echo "[DEFAULT] ${image_prefix}_image: $image_name cluster_name: $cluster_name -ci_flavor_id: $ci_flavor_id -medium_flavor_id: $medium_flavor_id -large_flavor_id: $large_flavor_id +ci_flavor_id: ${ci_flavor_id:?} +medium_flavor_id: ${medium_flavor_id:?} +large_flavor_id: ${large_flavor_id:?} " | tee ${template_vars_file} }