Merge "Extract image variable name from scenario file"

This commit is contained in:
Jenkins 2016-11-24 14:25:23 +00:00 committed by Gerrit Code Review
commit 5940ee1a92
3 changed files with 13 additions and 39 deletions

View File

@ -57,28 +57,24 @@ case $plugin in
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:?}"
template_image_prefix="vanilla_two_seven_one"
;;
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:?}"
template_image_prefix="spark_1_6"
;;
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:?}"
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:?}"
template_image_prefix="cdh_5_7_0"
;;
ambari_2.2)
@ -87,36 +83,34 @@ case $plugin in
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:?}"
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:?}"
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:?}"
template_image_prefix="storm_1_0"
;;
esac
image_variable_name=$(get_image_variable_name $scenario_conf_file)
cd $SAHARA_PATH
sudo pip install . --no-cache-dir
enable_pypi
write_sahara_main_conf "$sahara_conf_file" "$sahara_plugin"
write_tests_conf "$cluster_name" "$template_image_prefix" "$image_name" "$scenario_conf_file"
write_tests_conf "$cluster_name" "$image_variable_name" "$image_name" "$scenario_conf_file"
start_sahara "$sahara_conf_file" "$mode" && run_tests "$scenario_conf_file"
print_python_env
cleanup_image "$plugin" "$os"

View File

@ -183,11 +183,11 @@ write_sahara_main_conf() {
write_tests_conf() {
local cluster_name=$1
local image_prefix=$2
local image_variable_name=$2
local image_name=$3
export NETWORK="neutron"
echo "[DEFAULT]
${image_prefix}_image: $image_name
$image_variable_name: $image_name
cluster_name: $cluster_name
ci_flavor_id: ${ci_flavor_id:?}
medium_flavor_id: ${medium_flavor_id:?}
@ -209,3 +209,9 @@ get_template_path() {
suffix=${plugin//_/-}
echo "$base_path/$suffix.yaml.mako"
}
get_image_variable_name() {
local scenario
scenario=$1
grep image < $scenario | awk '{ print $2 }' | sed "s/[{}$]//g"
}

View File

@ -26,14 +26,13 @@ mode="distribute"
concurrency=1
sahara_plugin=$(echo $plugin | awk -F '_' '{ print $1 } ')
scenario_conf_file=$(get_template_path $ZUUL_BRANCH $plugin $sahara_templates_path)
image_variable_name=$(get_image_variable_name $scenario_conf_file)
case $plugin in
ambari_2.3)
template_image_prefix="ambari_2_2"
image_name="ambari_2.2_c7"
;;
ambari_2.4)
template_image_prefix="ambari_2_2"
image_name="ambari_2.2_c7"
if [ $os == "u14" ]; then
image_name="ambari_2.2_u14"
@ -42,37 +41,12 @@ case $plugin in
vanilla_2.7.1)
# the only job to test aio approach
mode="aio"
template_image_prefix="vanilla_two_seven_one"
;;
cdh_5.4.0)
template_image_prefix="cdh_5_4_0"
;;
cdh_5.5.0)
template_image_prefix="cdh_5_5_0"
;;
cdh_5.7.0)
template_image_prefix="cdh_5_7_0"
;;
spark_1.3.1)
template_image_prefix="spark_1_3"
;;
spark_1.6.0)
template_image_prefix="spark_1_6"
;;
mapr_5.1.0.mrv2)
template_image_prefix="mapr_510mrv2"
;;
mapr_5.2.0.mrv2)
template_image_prefix="mapr_520mrv2"
;;
storm_1.0.1)
template_image_prefix="storm_1_0"
;;
esac
sudo pip install -r requirements.txt . --no-cache-dir
enable_pypi
write_sahara_main_conf "$sahara_conf_file" "$sahara_plugin"
write_tests_conf "$cluster_name" "$template_image_prefix" "$image_name" "$scenario_conf_file"
write_tests_conf "$cluster_name" "$image_variable_name" "$image_name" "$scenario_conf_file"
start_sahara "$sahara_conf_file" "$mode" && run_tests "$scenario_conf_file" "$concurrency"
print_python_env