Adjust gate-check-commit for deploy/upgrade testing

In order to facilitate periodic deployment and upgrade testing,
this patch implements an 'action' as a second CLI parameter for
the gate-check-commit script.

This seperates the 'action' from the 'scenario', allowing us to
execute a gate-check-commit for multiple scenarios instead of
being stuck with only one. That is why the 'upgrade' scenario
is removed.

This patch is partnered with this project-config change:
https://review.openstack.org/419517

The patch also tidies a few things up in order to make the
script a little more readable.

Change-Id: Ie62efc188d5eafd5bb64eb53f14c191dd50bef33
This commit is contained in:
Jesse Pretorius 2017-03-02 15:24:35 +00:00
parent 2b3ad52ff6
commit 2aa4a3f7d2
2 changed files with 40 additions and 37 deletions

View File

@ -17,26 +17,38 @@
set -e -u -x set -e -u -x
## Variables ----------------------------------------------------------------- ## Variables -----------------------------------------------------------------
# Successerator: How many times do we try before failing
export MAX_RETRIES=${MAX_RETRIES:-"2"} export MAX_RETRIES=${MAX_RETRIES:-"2"}
# tempest and testr options, default is to run tempest in serial # tempest and testr options, default is to run tempest in serial
export TESTR_OPTS=${TESTR_OPTS:-''} export TESTR_OPTS=${TESTR_OPTS:-''}
# Disable the python output buffering so that jenkins gets the output properly # Disable the python output buffering so that jenkins gets the output properly
export PYTHONUNBUFFERED=1 export PYTHONUNBUFFERED=1
# Extra options to pass to the AIO bootstrap process # Extra options to pass to the AIO bootstrap process
export BOOTSTRAP_OPTS=${BOOTSTRAP_OPTS:-''} export BOOTSTRAP_OPTS=${BOOTSTRAP_OPTS:-''}
# This variable is being added to ensure the gate job executes an exit # This variable is being added to ensure the gate job executes an exit
# function at the end of the run. # function at the end of the run.
export OSA_GATE_JOB=true export OSA_GATE_JOB=true
# Set the role fetch mode to any option [galaxy, git-clone]
# Set the role fetch mode to git-clone to avoid interactions
# with the Ansible galaxy API.
export ANSIBLE_ROLE_FETCH_MODE="git-clone" export ANSIBLE_ROLE_FETCH_MODE="git-clone"
# Set the scenario to execute based on the first CLI parameter # Set the scenario to execute based on the first CLI parameter
export SCENARIO=${1:-"aio"} export SCENARIO=${1:-"aio"}
# TODO(sc68cal) update the job configs to have the stable branch # Set the action base on the second CLI parameter
# So we have job names like: # Actions available: [ 'deploy', 'upgrade' ]
# gate-openstack-ansible-openstack-ansible-upgrade-newton-ubuntu-xenial-nv export ACTION=${2:-"deploy"}
export UPGRADE_BASEBRANCH=${2:-"ocata"}
export SCENARIO_BACKUP=${SCENARIO_BACKUP:-''} # Set the source branch for upgrade tests
# Be sure to change this whenever a new stable branch
# is created. The checkout must always be N-1.
export UPGRADE_SOURCE_BRANCH=${UPGRADE_SOURCE_BRANCH:-'stable/ocata'}
## Functions ----------------------------------------------------------------- ## Functions -----------------------------------------------------------------
info_block "Checking for required libraries." 2> /dev/null || source "$(dirname "${0}")/scripts-library.sh" info_block "Checking for required libraries." 2> /dev/null || source "$(dirname "${0}")/scripts-library.sh"
@ -48,14 +60,15 @@ trap gate_job_exit_tasks EXIT
# Log some data about the instance and the rest of the system # Log some data about the instance and the rest of the system
log_instance_info log_instance_info
# If the action is to upgrade, then store the current SHA,
# checkout the source SHA before executing the greenfield
# deployment.
if [[ "${ACTION}" == "upgrade" ]]; then
# Store the target SHA/branch
export UPGRADE_TARGET_BRANCH=$(git rev-parse HEAD)
if [[ "$SCENARIO" == "upgrade" ]]; then # Now checkout the source SHA/branch
# First, check out the base branch and build an AIO git checkout origin/${UPGRADE_SOURCE_BRANCH}
git checkout origin/stable/$UPGRADE_BASEBRANCH
# Do a quick swap of SCENARIO since the newton branch doesn't know about the upgrade scenario
export SCENARIO_BACKUP=$SCENARIO
SCENARIO="aio"
fi fi
# Get minimum disk size # Get minimum disk size
@ -121,16 +134,21 @@ bash "$(dirname "${0}")/run-playbooks.sh"
# Log some data about the instance and the rest of the system # Log some data about the instance and the rest of the system
log_instance_info log_instance_info
if [ ! -z $SCENARIO_BACKUP ]; then # If the action is to upgrade, then checkout the original SHA for
# Restore the scenario from L56 # the checkout, and execute the upgrade.
SCENARIO=$SCENARIO_BACKUP if [[ "${ACTION}" == "upgrade" ]]; then
fi
if [[ "$SCENARIO" == "upgrade" ]]; then # Checkout the original HEAD we started with
# Hopefully we can re-check out the patch from Zuul. git checkout ${UPGRADE_TARGET_BRANCH}
git checkout FETCH_HEAD
# There is a protection in the run-upgrade script
# to prevent people doing anything silly. We need
# to bypass that for an automated test.
export I_REALLY_KNOW_WHAT_I_AM_DOING=true export I_REALLY_KNOW_WHAT_I_AM_DOING=true
# Execute the upgrade script.
bash "$(dirname "${0}")/run-upgrade.sh" bash "$(dirname "${0}")/run-upgrade.sh"
fi fi
exit_success exit_success

View File

@ -22,9 +22,8 @@
- role: "pip_install" - role: "pip_install"
- role: "bootstrap-host" - role: "bootstrap-host"
vars: vars:
openstack_confd_entries: "{{ confd_overrides[scenario] }}" openstack_confd_entries: "{{ confd_overrides[bootstrap_host_scenario] }}"
bootstrap_host_scenario: "{{ scenario }}" bootstrap_host_scenario: "{{ lookup('env','SCENARIO') | default('aio', true) }}"
scenario: "{{ lookup('env','SCENARIO') | default('aio', true) }}"
confd_overrides: confd_overrides:
aio: aio:
- name: cinder.yml.aio - name: cinder.yml.aio
@ -45,20 +44,6 @@
- name: keystone.yml.aio - name: keystone.yml.aio
- name: neutron.yml.aio - name: neutron.yml.aio
- name: nova.yml.aio - name: nova.yml.aio
upgrade:
# This starts as an AIO box, then an upgrade is run
- name: aodh.yml.aio
- name: cinder.yml.aio
- name: ceilometer.yml.aio
- name: designate.yml.aio
- name: glance.yml.aio
- name: gnocchi.yml.aio
- name: heat.yml.aio
- name: horizon.yml.aio
- name: keystone.yml.aio
- name: neutron.yml.aio
- name: nova.yml.aio
- name: swift.yml.aio
sftp_subsystem: "{{ (ansible_pkg_mgr == 'apt') | ternary('sftp /usr/lib/openssh/sftp-server','sftp /usr/libexec/openssh/sftp-server') }}" sftp_subsystem: "{{ (ansible_pkg_mgr == 'apt') | ternary('sftp /usr/lib/openssh/sftp-server','sftp /usr/libexec/openssh/sftp-server') }}"
sshd: sshd:
ListenAddress: ListenAddress: