Merge "Refactor retrieving scenario template path"

This commit is contained in:
Jenkins 2016-11-24 14:25:18 +00:00 committed by Gerrit Code Review
commit 804e5aeb33
3 changed files with 18 additions and 30 deletions

View File

@ -50,13 +50,13 @@ case "${os}" in
;;
esac
scenario_conf_file=$(get_template_path $ZUUL_BRANCH $plugin $sahara_templates_path)
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:?}"
mode=distribute
scenario_conf_file="$sahara_templates_path/vanilla-2.7.1.yaml.mako"
template_image_prefix="vanilla_two_seven_one"
;;
@ -64,7 +64,6 @@ case $plugin in
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"
;;
@ -72,7 +71,6 @@ case $plugin in
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"
;;
@ -80,7 +78,6 @@ case $plugin in
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"
;;
@ -97,8 +94,6 @@ case $plugin in
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"
;;
@ -106,8 +101,6 @@ case $plugin in
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"
;;
@ -115,7 +108,6 @@ case $plugin in
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"
;;
esac

View File

@ -194,3 +194,18 @@ medium_flavor_id: ${medium_flavor_id:?}
large_flavor_id: ${large_flavor_id:?}
" | tee ${template_vars_file}
}
get_template_path() {
local branch=$1
local plugin=$2
local base_path=$3
if [[ $branch == *"stable"* ]]; then
local release
release=${branch//stable\//}
base_path="$base_path/$release"
fi
local suffix
suffix=${plugin//_/-}
echo "$base_path/$suffix.yaml.mako"
}

View File

@ -25,24 +25,14 @@ image_name=${plugin}_${os}
mode="distribute"
concurrency=1
sahara_plugin=$(echo $plugin | awk -F '_' '{ print $1 } ')
case $ZUUL_BRANCH in
stable/liberty)
sahara_templates_path="$sahara_templates_path/liberty"
;;
stable/mitaka)
sahara_templates_path="$sahara_templates_path/mitaka"
;;
esac
scenario_conf_file=$(get_template_path $ZUUL_BRANCH $plugin $sahara_templates_path)
case $plugin in
ambari_2.3)
scenario_conf_file="$sahara_templates_path/ambari-2.3.yaml.mako"
template_image_prefix="ambari_2_2"
image_name="ambari_2.2_c7"
;;
ambari_2.4)
scenario_conf_file="$sahara_templates_path/ambari-2.4.yaml.mako"
template_image_prefix="ambari_2_2"
image_name="ambari_2.2_c7"
if [ $os == "u14" ]; then
@ -52,39 +42,30 @@ case $plugin in
vanilla_2.7.1)
# the only job to test aio approach
mode="aio"
scenario_conf_file="$sahara_templates_path/vanilla-2.7.1.yaml.mako"
template_image_prefix="vanilla_two_seven_one"
;;
cdh_5.4.0)
scenario_conf_file="$sahara_templates_path/cdh-5.4.0.yaml.mako"
template_image_prefix="cdh_5_4_0"
;;
cdh_5.5.0)
scenario_conf_file="$sahara_templates_path/cdh-5.5.0.yaml.mako"
template_image_prefix="cdh_5_5_0"
;;
cdh_5.7.0)
scenario_conf_file="$sahara_templates_path/cdh-5.7.0.yaml.mako"
template_image_prefix="cdh_5_7_0"
;;
spark_1.3.1)
scenario_conf_file="$sahara_templates_path/spark-1.3.1.yaml.mako"
template_image_prefix="spark_1_3"
;;
spark_1.6.0)
scenario_conf_file="$sahara_templates_path/spark-1.6.0.yaml.mako"
template_image_prefix="spark_1_6"
;;
mapr_5.1.0.mrv2)
scenario_conf_file="$sahara_templates_path/mapr-5.1.0.mrv2.yaml.mako"
template_image_prefix="mapr_510mrv2"
;;
mapr_5.2.0.mrv2)
scenario_conf_file="$sahara_templates_path/mapr-5.2.0.mrv2.yaml.mako"
template_image_prefix="mapr_520mrv2"
;;
storm_1.0.1)
scenario_conf_file="$sahara_templates_path/storm-1.0.1.yaml.mako"
template_image_prefix="storm_1_0"
;;
esac