Add ability to use a different release per playbook

We are changing the way we are passing releases to the playbooks.
This change adds the ability to use the new release handling script. It
enables it only for 4 jobs. Two should be moved to the new way of
handling releases, two are there to test the backwards compatibility
offered by the script.
If the script is uses and produces an output, the new method will be
activated, by filling a dictionary with playbook as key and release as
value.
If there is no output from the script, the dictionary will be empty and
the default QUICKSTART_RELEASE file will be used instead.

Co-Authored-By: Gabriele Cerami <gcerami@redhat.com>
Co-Authored-By: Ronelle Landy <rlandy@redhat.com>
Change-Id: I6514ba15ff4300ac4bd4fe543d3a4954aeb6f175
This commit is contained in:
John Trowbridge 2018-05-07 08:38:44 -04:00
parent 93f091b1ac
commit 48e2b054e7
2 changed files with 51 additions and 7 deletions

View File

@ -122,6 +122,10 @@ LOCAL_WORKING_DIR="$WORKSPACE/.quickstart"
LWD=$LOCAL_WORKING_DIR
QUICKSTART_SH_JOBS="ovb-3ctlr_1comp-featureset001 multinode-1ctlr-featureset010"
export RELEASES_FILE_OUTPUT=$WORKSPACE/logs/releases.sh
export RELEASES_SCRIPT=$TRIPLEO_ROOT/tripleo-ci/scripts/emit_releases_file/emit_releases_file.py
export RELEASES_SCRIPT_LOGFILE=$WORKSPACE/logs/emit_releases_file.log
# Assemble quickstart configuration based on job type keywords
for JOB_TYPE_PART in $(sed 's/-/ /g' <<< "${TOCI_JOBTYPE:-}") ; do
case $JOB_TYPE_PART in
@ -213,6 +217,15 @@ for JOB_TYPE_PART in $(sed 's/-/ /g' <<< "${TOCI_JOBTYPE:-}") ; do
done
if [[ -f "$RELEASES_SCRIPT" ]] && [[ $FEATURESET_FILE =~ '037' || $FEATURESET_FILE =~ '050' || $FEATURESET_FILE =~ '010' || $FEATURESET_FILE =~ '011' ]]; then
python $RELEASES_SCRIPT \
--stable-release ${STABLE_RELEASE:-"master"} \
--featureset-file $TRIPLEO_ROOT/tripleo-quickstart/config/general_config/$(basename $FEATURESET_FILE) \
--output-file $RELEASES_FILE_OUTPUT \
--log-file $RELEASES_SCRIPT_LOGFILE
fi
if [[ ! -z $NODES_FILE ]]; then
pushd $TRIPLEO_ROOT/tripleo-quickstart
NODECOUNT=$(shyaml get-value node_count < $NODES_FILE)

View File

@ -40,12 +40,6 @@ QUICKSTART_VENV_CMD="
QUICKSTART_INSTALL_CMD="
$LOCAL_WORKING_DIR/bin/ansible-playbook
--extra-vars @$LOCAL_WORKING_DIR/config/release/tripleo-ci/$QUICKSTART_RELEASE.yml
$NODES_ARGS
$FEATURESET_CONF
$ENV_VARS
$EXTRA_VARS
$DEFAULT_ARGS
--tags $TAGS
--skip-tags teardown-all
"
@ -64,6 +58,35 @@ QUICKSTART_COLLECTLOGS_CMD="$LOCAL_WORKING_DIR/bin/ansible-playbook \
--skip-tags teardown-all \
"
export QUICKSTART_DEFAULT_RELEASE_ARG="--extra-vars @$LOCAL_WORKING_DIR/config/release/tripleo-ci/$QUICKSTART_RELEASE.yml"
declare -A RELEASE_ARGS=()
if [[ -f "$RELEASES_FILE_OUTPUT" ]]; then
source $RELEASES_FILE_OUTPUT
declare -A RELEASE_ARGS=(
["multinode-undercloud.yml"]="--extra-vars
@$LOCAL_WORKING_DIR/config/release/tripleo-ci/$UNDERCLOUD_INSTALL_RELEASE.yml"
["multinode-undercloud-upgrade.yml"]="--extra-vars
@$LOCAL_WORKING_DIR/config/release/tripleo-ci/$UNDERCLOUD_TARGET_RELEASE.yml"
["multinode-overcloud-prep.yml"]="--extra-vars
@$LOCAL_WORKING_DIR/config/release/tripleo-ci/$OVERCLOUD_DEPLOY_RELEASE.yml"
["multinode-overcloud.yml"]="--extra-vars
@$LOCAL_WORKING_DIR/config/release/tripleo-ci/$OVERCLOUD_DEPLOY_RELEASE.yml"
["multinode-overcloud-update.yml"]="--extra-vars
@$LOCAL_WORKING_DIR/config/release/tripleo-ci/$OVERCLOUD_DEPLOY_RELEASE.yml"
["multinode-overcloud-upgrade.yml"]="--extra-vars
@$LOCAL_WORKING_DIR/config/release/tripleo-ci/$OVERCLOUD_TARGET_RELEASE.yml"
["multinode-validate.yml"]="--extra-vars
@$LOCAL_WORKING_DIR/config/release/tripleo-ci/$OVERCLOUD_TARGET_RELEASE.yml"
)
fi
declare -A PLAYBOOKS_ARGS=(
["baremetal-full-overcloud.yml"]=" --extra-vars validation_args='--validation-errors-nonfatal' "
["multinode-undercloud-upgrade.yml"]=" --extra-vars @$LOCAL_WORKING_DIR/config/release/tripleo-ci/${UPGRADE_RELEASE:-$QUICKSTART_RELEASE}.yml"
@ -94,9 +117,17 @@ source $OOOQ_DIR/ansible_ssh_env.sh
[[ -n ${STATS_OOOQ:-''} ]] && export STATS_OOOQ=$(( $(date +%s) - STATS_OOOQ ))
for playbook in $PLAYBOOKS; do
echo "${RELEASE_ARGS[$playbook]:=$QUICKSTART_DEFAULT_RELEASE_ARG}"
run_with_timeout $START_JOB_TIME $QUICKSTART_INSTALL_CMD \
--extra-vars ci_job_end_time=$(( START_JOB_TIME + REMAINING_TIME*60 )) \
"${RELEASE_ARGS[$playbook]:=$QUICKSTART_DEFAULT_RELEASE_ARG}" \
$NODES_ARGS \
$FEATURESET_CONF \
$ENV_VARS \
$EXTRA_VARS \
$DEFAULT_ARGS \
--extra-vars ci_job_end_time=$(( START_JOB_TIME + REMAINING_TIME*60 )) \
$LOCAL_WORKING_DIR/playbooks/$playbook "${PLAYBOOKS_ARGS[$playbook]:-}" \
2>&1 | tee -a $LOGS_DIR/quickstart_install.log && exit_value=0 || exit_value=$?