Remove unnecessary code from toci_* scripts

Detect and remove unnecessary code from toci_* scripts
Simplify tripleo-upgrades roles installation with ZUUL_BRANCH

Change-Id: Ie230aa0640e41a33e10e6656b69e1db4a6819127
This commit is contained in:
Sagi Shnaidman 2018-06-20 15:19:44 +03:00
parent 475da5cdf8
commit 8c6db50589
5 changed files with 297 additions and 1073 deletions

View File

@ -1,346 +0,0 @@
#!/usr/bin/env bash
source $(dirname $0)/scripts/common_vars.bash
source $(dirname $0)/scripts/common_functions.sh
set -eux
export START_JOB_TIME=$(date +%s)
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
# Maintain compatibility with the old jobtypes
if [[ ! $TOCI_JOBTYPE =~ "featureset" ]]; then
echo "WARNING: USING OLD DEPLOYMENT METHOD. THE OLD DEPLOYMENT METHOD THAT USES tripleo.sh WILL BE DEPRECATED IN THE QUEENS CYCLE"
echo "TO USE THE NEW DEPLOYMENT METHOD WITH QUICKSTART, SETUP A FEATURESET FILE AND ADD featuresetXXX TO THE JOB TYPE"
exec $TRIPLEO_ROOT/tripleo-ci/toci_gate_test-orig.sh
fi
source $TRIPLEO_ROOT/tripleo-ci/scripts/oooq_common_functions.sh
if [ -f /etc/nodepool/provider ] ; then
# this sets
# NODEPOOL_PROVIDER (e.g tripleo-test-cloud-rh1)
# NODEPOOL_CLOUD (e.g.tripleo-test-cloud-rh1)
# NODEPOOL_REGION (e.g. regionOne)
# NODEPOOL_AZ
source /etc/nodepool/provider
# source variables common across all the scripts.
source /etc/ci/mirror_info.sh
if [[ -z "${RHCLOUD-}" ]]; then
# host setup
export RHCLOUD=''
if [ ${NODEPOOL_CLOUD:-''} == 'tripleo-test-cloud-rh1' ]; then
RHCLOUD='rh1'
elif [ ${NODEPOOL_PROVIDER:-''} == 'rdo-cloud-tripleo' ]; then
RHCLOUD='rdocloud'
fi
if [[ "$RHCLOUD" != '' ]]; then
source $(dirname $0)/scripts/$RHCLOUD.env
# In order to save space remove the cached git repositories, at this point in
# CI the ones we are interested in have been cloned to /opt/stack/new. We
# can also remove some distro images cached on the images.
sudo rm -rf /opt/git /opt/stack/cache/files/mysql.qcow2 /opt/stack/cache/files/ubuntu-12.04-x86_64.tar.gz
fi
fi
fi
# default $NODEPOOL_PROVIDER if not already set as it's used later
export NODEPOOL_PROVIDER=${NODEPOOL_PROVIDER:-""}
# create logs dir (check if collect-logs doesn't already do this)
mkdir -p $WORKSPACE/logs
# Set job as failed until it's overwritten by pingtest/tempest real test subunit
cat $TRIPLEO_ROOT/tripleo-ci/scripts/fake_fail_subunit | gzip - > $WORKSPACE/logs/testrepository.subunit.gz
# Remove epel, either by epel-release, or unpackaged repo files
rpm -q epel-release && sudo yum -y erase epel-release
sudo rm -f /etc/yum.repos.d/epel*
# Clean any cached yum metadata, it maybe stale
sudo yum clean all
# NOTE(trown): In openstack-infra we have pip already, but this will ensure we
# have it available in other environments.
command -v pip || \
(curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"; sudo python get-pip.py)
# NOTE(pabelanger): Current hack to make centos-7 dib work.
# TODO(pabelanger): Why is python-requests installed from pip?
# TODO(amoralej): remove after https://review.openstack.org/#/c/468872/ is merged
sudo pip uninstall certifi -y || true
sudo pip uninstall urllib3 -y || true
sudo pip uninstall requests -y || true
sudo rpm -e --nodeps python2-certifi || :
sudo rpm -e --nodeps python2-urllib3 || :
sudo rpm -e --nodeps python2-requests || :
sudo yum -y install python-requests python-urllib3
sudo pip install shyaml
# JOB_NAME used to be available from jenkins, we need to create it ourselves until
# we remove our reliance on it.
# FIXME: JOB_NAME IS USED IN CACHE UPLOAD AND PROMOTION,
# IF WE CHANGE THE JOB NAME, WE MUST UPDATE upload.cgi in mirror server
if [[ -z "${JOB_NAME-}" ]]; then
JOB_NAME=${WORKSPACE%/}
export JOB_NAME=${JOB_NAME##*/}
fi
# Sets whether or not this job will upload images.
export PERIODIC=0
# Sets which repositories to use in the job
export QUICKSTART_RELEASE="${STABLE_RELEASE:-master}"
# Stores OVB undercloud instance id
export UCINSTANCEID="null"
# Define environment variables file
export ENV_VARS=""
# Define file with set of features to test
export FEATURESET_FILE=""
export FEATURESET_CONF=""
# Define file with nodes topology
export NODES_FILE=""
# Set the number of overcloud nodes
export NODECOUNT=0
# Sets the undercloud hostname
export UNDERCLOUD=""
# Select the tags to run
export TAGS=all
# Identify in which environment we're deploying
export ENVIRONMENT=""
# Set the overcloud hosts for multinode
export OVERCLOUD_HOSTS=
export CONTROLLER_HOSTS=
export SUBNODES_SSH_KEY=
TIMEOUT_SECS=$((DEVSTACK_GATE_TIMEOUT*60))
export EXTRA_VARS=${EXTRA_VARS:-""}
export NODES_ARGS=""
export EXTRANODE=""
# Set playbook execution status
export PLAYBOOK_DRY_RUN=${PLAYBOOK_DRY_RUN:=0}
export COLLECT_CONF="$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/collect-logs.yml"
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
featureset*)
FEATURESET_FILE="$LWD/config/general_config/$JOB_TYPE_PART.yml"
FEATURESET_CONF="$FEATURESET_CONF --extra-vars @$FEATURESET_FILE"
MIXED_UPGRADE_TYPE=''
# Order matters. ffu featureset has both mixed version and ffu_overcloud_upgrade.
if is_featureset ffu_overcloud_upgrade "$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/$JOB_TYPE_PART.yml"; then
MIXED_UPGRADE_TYPE='ffu_upgrade'
elif is_featureset mixed_upgrade "$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/$JOB_TYPE_PART.yml"; then
MIXED_UPGRADE_TYPE='mixed_upgrade'
elif is_featureset overcloud_update "$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/$JOB_TYPE_PART.yml"; then
TAGS="$TAGS,overcloud-update"
elif is_featureset undercloud_upgrade "$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/$JOB_TYPE_PART.yml"; then
TAGS="$TAGS,undercloud-upgrade"
export UPGRADE_RELEASE=$QUICKSTART_RELEASE
export QUICKSTART_RELEASE=$(previous_release_mixed_upgrade_case "${UPGRADE_RELEASE}")
fi
# Set UPGRADE_RELEASE if applicable
if [ -n "${MIXED_UPGRADE_TYPE}" ]; then
export UPGRADE_RELEASE=$(previous_release_from "${STABLE_RELEASE}" "${MIXED_UPGRADE_TYPE}")
QUICKSTART_RELEASE="$QUICKSTART_RELEASE-undercloud-$UPGRADE_RELEASE-overcloud"
# Run overcloud-upgrade tag only in upgrades jobs
TAGS="$TAGS,overcloud-upgrade"
fi
;;
ovb)
OVB=1
ENVIRONMENT="ovb"
UCINSTANCEID=$(http_proxy= curl http://169.254.169.254/openstack/2015-10-15/meta_data.json | python -c 'import json, sys; print json.load(sys.stdin)["uuid"]')
if [[ " $QUICKSTART_SH_JOBS " =~ " $TOCI_JOBTYPE " ]]; then
export PLAYBOOKS=${PLAYBOOKS:-"baremetal-full-deploy.yml"}
else
export PLAYBOOKS=${PLAYBOOKS:-"ovb-setup.yml baremetal-full-undercloud.yml baremetal-full-overcloud-prep.yml baremetal-full-overcloud.yml baremetal-full-overcloud-validate.yml"}
fi
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/ovb.yml"
if [[ -f "$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/ovb-$RHCLOUD.yml" ]]; then
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/ovb-$RHCLOUD.yml"
fi
UNDERCLOUD="undercloud"
;;
multinode)
SUBNODES_SSH_KEY=/etc/nodepool/id_rsa
ENVIRONMENT="osinfra"
if [[ " $QUICKSTART_SH_JOBS " =~ " $TOCI_JOBTYPE " ]]; then
export PLAYBOOKS=${PLAYBOOKS:-"multinode.yml"}
else
export PLAYBOOKS=${PLAYBOOKS:-"quickstart.yml multinode-undercloud.yml multinode-overcloud-prep.yml multinode-overcloud.yml multinode-overcloud-update.yml multinode-overcloud-upgrade.yml multinode-validate.yml"}
fi
FEATURESET_CONF=" --extra-vars @$LWD/config/general_config/featureset-multinode-common.yml $FEATURESET_CONF"
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/multinode.yml"
if [[ $NODEPOOL_PROVIDER == "rdo-cloud-tripleo" ]]; then
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/multinode-rdocloud.yml"
fi
UNDERCLOUD="127.0.0.2"
TAGS="build,undercloud-setup,undercloud-scripts,undercloud-install,undercloud-post-install,tripleo-validations,overcloud-scripts,overcloud-prep-config,overcloud-prep-containers,overcloud-deploy,overcloud-post-deploy,overcloud-validate"
CONTROLLER_HOSTS=$(sed -n 1,1p /etc/nodepool/sub_nodes_private)
OVERCLOUD_HOSTS=$(cat /etc/nodepool/sub_nodes_private)
;;
singlenode)
ENVIRONMENT="osinfra"
UNDERCLOUD="127.0.0.2"
if [[ " $QUICKSTART_SH_JOBS " =~ " $TOCI_JOBTYPE " ]]; then
export PLAYBOOKS=${PLAYBOOKS:-"multinode.yml"}
else
export PLAYBOOKS=${PLAYBOOKS:-"quickstart.yml multinode-undercloud.yml multinode-undercloud-upgrade.yml multinode-overcloud-prep.yml multinode-overcloud.yml multinode-overcloud-upgrade.yml multinode-validate.yml"}
fi
FEATURESET_CONF=" --extra-vars @$LWD/config/general_config/featureset-multinode-common.yml $FEATURESET_CONF"
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/multinode.yml"
if [[ $NODEPOOL_PROVIDER == "rdo-cloud-tripleo" ]]; then
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/multinode-rdocloud.yml"
fi
TAGS="build,undercloud-setup,undercloud-scripts,undercloud-install,undercloud-validate,images"
;;
standalone)
ENVIRONMENT="osinfra"
UNDERCLOUD="127.0.0.2"
export PLAYBOOKS=${PLAYBOOKS:-"quickstart.yml multinode-standalone.yml"}
FEATURESET_CONF=" --extra-vars @$LWD/config/general_config/featureset-multinode-common.yml $FEATURESET_CONF"
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/multinode.yml"
if [[ $NODEPOOL_PROVIDER == "rdo-cloud-tripleo" ]]; then
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/multinode-rdocloud.yml"
fi
TAGS="build,standalone"
;;
periodic)
PERIODIC=1
QUICKSTART_RELEASE="promotion-testing-hash-${QUICKSTART_RELEASE}"
;;
gate)
;;
dryrun)
PLAYBOOK_DRY_RUN=1
;;
*)
# the rest should be node configuration
NODES_FILE="$TRIPLEO_ROOT/tripleo-quickstart/config/nodes/$JOB_TYPE_PART.yml"
;;
esac
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)
popd
NODES_ARGS="--extra-vars @$NODES_FILE"
for PART in $(sed 's/_/ /g' <<< "$NODES_FILE") ; do
if [[ "$PART" == *"supp"* ]]; then
EXTRANODE=" --extra-nodes ${PART//[!0-9]/} "
fi;
done
fi
# Import gated tripleo-upgrade in oooq for upgrades/updates jobs
if [[ -d $TRIPLEO_ROOT/tripleo-upgrade ]]; then
echo "file://${TRIPLEO_ROOT}/tripleo-upgrade/#egg=tripleo-upgrade" >> ${TRIPLEO_ROOT}/tripleo-quickstart/quickstart-extras-requirements.txt
else
if [[ -n "$STABLE_RELEASE" ]]; then
TRIPLEO_UPGRADE_BRANCH="stable/${STABLE_RELEASE}"
else
TRIPLEO_UPGRADE_BRANCH="master"
fi
# Otherwise, if not importing it, oooq will fail when loading
# tripleo-upgrade role in the playbook.
echo "git+https://git.openstack.org/openstack/tripleo-upgrade.git@${TRIPLEO_UPGRADE_BRANCH}#egg=tripleo-upgrade" >> ${TRIPLEO_ROOT}/tripleo-quickstart/quickstart-extras-requirements.txt
fi
# Start time tracking
export STATS_TESTENV=$(date +%s)
pushd $TRIPLEO_ROOT/tripleo-ci
if [ -z "${TE_DATAFILE:-}" -a "$ENVIRONMENT" = "ovb" ] ; then
export GEARDSERVER=${TEBROKERIP-192.168.1.1}
# NOTE(pabelanger): We need gear for testenv, but this really should be
# handled by tox.
sudo pip install gear
# Kill the whole job if it doesn't get a testenv in 20 minutes as it likely will timout in zuul
( sleep 1200 ; [ ! -e /tmp/toci.started ] && sudo kill -9 $$ ) &
# We only support multi-nic at the moment
NETISO_ENV="multi-nic"
# provision env in rh cloud, then start quickstart
./testenv-client -b $GEARDSERVER:4730 -t $TIMEOUT_SECS \
--envsize $NODECOUNT --ucinstance $UCINSTANCEID \
--net-iso $NETISO_ENV $EXTRANODE -- ./toci_quickstart.sh
elif [ "$ENVIRONMENT" = "ovb" ] ; then
# We only support multi-nic at the moment
NETISO_ENV="multi-nic"
./toci_quickstart.sh
else
# multinode preparation
# Clear out any puppet modules on the node placed their by infra configuration
sudo rm -rf /etc/puppet/modules/*
# Copy nodepool keys to current user
sudo cp /etc/nodepool/id_rsa* $HOME/.ssh/
sudo chown $USER:$USER $HOME/.ssh/id_rsa*
chmod 0600 $HOME/.ssh/id_rsa*
# pre-ansible requirement
sudo mkdir -p /root/.ssh/
cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
cat $HOME/.ssh/authorized_keys | sudo tee -a /root/.ssh/authorized_keys
sudo chmod 0600 /root/.ssh/authorized_keys
sudo chown root:root /root/.ssh/authorized_keys
# everything below here *MUST* be translated to a role ASAP
# empty image to fool overcloud deployment
# set no_proxy variable
export IP_DEVICE=${IP_DEVICE:-"eth0"}
MY_IP=$(ip addr show dev $IP_DEVICE | awk '/inet / {gsub("/.*", "") ; print $2}')
MY_IP_eth1=$(ip addr show dev eth1 | awk '/inet / {gsub("/.*", "") ; print $2}') || MY_IP_eth1=""
export http_proxy=""
undercloud_net_range="192.168.24."
undercloud_services_ip=$undercloud_net_range"1"
undercloud_haproxy_public_ip=$undercloud_net_range"2"
undercloud_haproxy_admin_ip=$undercloud_net_range"3"
export no_proxy=$undercloud_services_ip,$undercloud_haproxy_public_ip,$undercloud_haproxy_admin_ip,$MY_IP,$MY_IP_eth1
# multinode bootstrap script
export DO_BOOTSTRAP_SUBNODES=${DO_BOOTSTRAP_SUBNODES:-1}
export BOOTSTRAP_SUBNODES_MINIMAL=1
overcloud_release=${UPGRADE_RELEASE:-$STABLE_RELEASE}
if [ "${overcloud_release}" = "newton" ]; then
BOOTSTRAP_SUBNODES_MINIMAL=0
fi
echo_vars_to_deploy_env_oooq
subnodes_scp_deploy_env
if [ "$DO_BOOTSTRAP_SUBNODES" = "1" ]; then
$TRIPLEO_ROOT/tripleo-ci/scripts/tripleo.sh \
--bootstrap-subnodes \
2>&1 | awk '{ print strftime("%Y-%m-%d %H:%M:%S |"), $0; fflush(); }' | sudo tee /var/log/bootstrap-subnodes.log \
|| (tail -n 50 /var/log/bootstrap-subnodes.log && false)
fi
# finally, run quickstart
./toci_quickstart.sh
fi
echo "Run completed"
echo "tripleo.${STABLE_RELEASE:-master}.${TOCI_JOBTYPE}.logs.size_mb" "$(du -sm $WORKSPACE/logs | awk {'print $1'})" "$(date +%s)" | nc 66.187.229.172 2003 || true

View File

@ -1,432 +0,0 @@
#!/usr/bin/env bash
set -eux
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
# Mirrors
# NOTE(pabelanger): We have access to AFS mirrors, lets use them.
[ -f /etc/nodepool/provider ] && source /etc/nodepool/provider
[ -f /etc/ci/mirror_info.sh ] && source /etc/ci/mirror_info.sh
source $(dirname $0)/scripts/common_vars.bash
export START_JOB_TIME=$(date +%s)
if [ $NODEPOOL_CLOUD == 'tripleo-test-cloud-rh1' ]; then
source $(dirname $0)/scripts/rh1.env
# In order to save space remove the cached git repositories, at this point in
# CI the ones we are interested in have been cloned to /opt/stack/new. We
# can also remove some distro images cached on the images.
sudo rm -rf /opt/git /opt/stack/cache/files/mysql.qcow2 /opt/stack/cache/files/ubuntu-12.04-x86_64.tar.gz
fi
# Clean any cached yum metadata, it maybe stale
sudo yum clean all
# NOTE(pabelanger): Current hack to make centos-7 dib work.
# TODO(pabelanger): Why is python-requests installed from pip?
# TODO(amoralej): remove after https://review.openstack.org/#/c/468872/ is merged
sudo pip uninstall certifi -y || true
sudo pip uninstall urllib3 -y || true
sudo pip uninstall requests -y || true
sudo rpm -e --nodeps python2-certifi || :
sudo rpm -e --nodeps python2-urllib3 || :
sudo rpm -e --nodeps python2-requests || :
sudo yum -y install python-requests python-urllib3
# Remove metrics from a previous run
rm -f /tmp/metric-start-times /tmp/metrics-data
# JOB_NAME used to be available from jenkins, we need to create it ourselves until
# we remove our reliance on it.
if [[ -z "${JOB_NAME-}" ]]; then
JOB_NAME=${WORKSPACE%/}
export JOB_NAME=${JOB_NAME##*/}
fi
# cd to toci directory so relative paths work
cd $(dirname $0)
# Only define $http_proxy if it is unset (use "-" instead of ":-" in the
# parameter expansion). This will allow an external script to override using a
# proxy by setting export http_proxy=""
export http_proxy=${http_proxy-"http://192.168.1.100:3128/"}
export GEARDSERVER=${TEBROKERIP-192.168.1.1}
export MIRRORSERVER=${MIRRORIP-192.168.1.101}
export CACHEUPLOAD=0
export INTROSPECT=0
export NODECOUNT=2
export PACEMAKER=0
export UNDERCLOUD_MAJOR_UPGRADE=0
export OVERCLOUD_MAJOR_UPGRADE=0
export MAJOR_UPGRADE=0
export UPGRADE_RELEASE=
export UPGRADE_ENV=
# Whether or not we deploy an Overcloud
export OVERCLOUD=1
# NOTE(bnemec): At this time, the undercloud install + image build is taking from
# 1 hour to 1 hour and 15 minutes on the jobs I checked. The devstack gate timeout
# is 170 minutes, so subtracting 90 should leave us an hour and 20 minutes for
# the deploy. Hopefully that's enough, while still leaving some cushion to come
# in under the gate timeout so we can collect logs.
OVERCLOUD_DEPLOY_TIMEOUT=$((DEVSTACK_GATE_TIMEOUT-90))
# NOTE(bnemec): Hard-coding this to 45 minutes based on current Graphite metrics
OVERCLOUD_UPDATE_TIMEOUT=45
export OVERCLOUD_SSH_USER=${OVERCLOUD_SSH_USER:-"jenkins"}
export OVERCLOUD_DEPLOY_ARGS=${OVERCLOUD_DEPLOY_ARGS:-""}
export OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS --libvirt-type=qemu -t $OVERCLOUD_DEPLOY_TIMEOUT -e /usr/share/openstack-tripleo-heat-templates/environments/debug.yaml"
export OVERCLOUD_UPDATE_ARGS=
export OVERCLOUD_PINGTEST_ARGS="--skip-pingtest-cleanup"
export UNDERCLOUD_SSL=0
export UNDERCLOUD_HEAT_CONVERGENCE=0
export UNDERCLOUD_IDEMPOTENT=0
export UNDERCLOUD_SANITY_CHECK=0
export TRIPLEO_SH_ARGS=
export NETISO_V4=0
export NETISO_V6=0
export RUN_PING_TEST=1
export RUN_TEMPEST_TESTS=0
export OVB=0
export UCINSTANCEID=NULL
export TOCIRUNNER="./toci_instack_ovb.sh"
export MULTINODE=0
export OVERCLOUD_ROLES=""
# Whether or not we run TripleO using OpenStack Infra nodes
export OSINFRA=0
export CONTROLLER_HOSTS=
export COMPUTE_HOSTS=
export SUBNODES_SSH_KEY=
export TEST_OVERCLOUD_DELETE=0
export OOOQ=0
export DEPLOY_OVB_EXTRA_NODE=0
export CONTAINERS=0
export CA_SERVER=0
export UNDERCLOUD_TELEMETRY=0
export UNDERCLOUD_UI=0
export UNDERCLOUD_VALIDATIONS=0
export PREDICTABLE_PLACEMENT=0
export OPSTOOLS_REPO_ENABLED=0
export POSTCI=1
export BOOTSTRAP_SUBNODES_MINIMAL=1
export DO_BOOTSTRAP_SUBNODES=${DO_BOOTSTRAP_SUBNODES:-1}
if [[ $TOCI_JOBTYPE =~ upgrades ]]; then
# We deploy a master Undercloud and an Overcloud with the
# previous release. The pingtest is disable because it won't
# work with the few services deployed.
if [ "$STABLE_RELEASE" = "queens" ]; then
UPGRADE_RELEASE=pike
elif [ "$STABLE_RELEASE" = "pike" ]; then
UPGRADE_RELEASE=ocata
elif [ "$STABLE_RELEASE" = "ocata" ]; then
UPGRADE_RELEASE=newton
elif [ -z $STABLE_RELEASE ]; then
UPGRADE_RELEASE=pike
fi
fi
if [[ $TOCI_JOBTYPE =~ scenario ]]; then
export MULTINODE_ENV_NAME=${TOCI_JOBTYPE#periodic-}
# enable opstools repository for scenario001
if [[ "$MULTINODE_ENV_NAME" =~ scenario001-multinode ]]; then
OPSTOOLS_REPO_ENABLED=1
fi
export MULTINODE_ENV_NAME=${MULTINODE_ENV_NAME%-upgrades}
else
export MULTINODE_ENV_NAME='multinode'
fi
if [[ $TOCI_JOBTYPE =~ upgrades ]]; then
export MULTINODE_ENV_PATH=$TRIPLEO_ROOT/$UPGRADE_RELEASE/usr/share/openstack-tripleo-heat-templates/ci/environments/$MULTINODE_ENV_NAME.yaml
else
export MULTINODE_ENV_PATH=/usr/share/openstack-tripleo-heat-templates/ci/environments/$MULTINODE_ENV_NAME.yaml
fi
if [[ "$TOCI_JOBTYPE" =~ "periodic" && "$TOCI_JOBTYPE" =~ "-ha" ]]; then
TEST_OVERCLOUD_DELETE=1
elif [[ "$TOCI_JOBTYPE" =~ "periodic" && "$TOCI_JOBTYPE" =~ "-nonha" ]]; then
UNDERCLOUD_IDEMPOTENT=1
fi
# start dstat early
# TODO add it to the gate image building
rpm -q dstat nmap-ncat || sudo yum install -y dstat nmap-ncat #nc is for metrics
mkdir -p "$WORKSPACE/logs"
dstat -tcmndrylpg --top-cpu-adv --top-io-adv --nocolor | tee --append $WORKSPACE/logs/dstat.log > /dev/null &
disown
# Switch defaults based on the job name
for JOB_TYPE_PART in $(sed 's/-/ /g' <<< "${TOCI_JOBTYPE:-}") ; do
case $JOB_TYPE_PART in
updates)
if [[ "$TOCI_JOBTYPE" =~ 'ovb-updates' ]] ; then
NODECOUNT=3
ENDPOINT_LIST_LOCATION=/usr/share/openstack-tripleo-heat-templates/environments
CA_ENVIRONMENT_FILE=inject-trust-anchor-hiera-ipv6.yaml
OVERCLOUD_DEPLOY_ARGS="
$OVERCLOUD_DEPLOY_ARGS
-e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml
-e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation-v6.yaml
-e $TRIPLEO_ROOT/tripleo-ci/test-environments/ipv6-network-templates/network-environment.yaml
-e $TRIPLEO_ROOT/tripleo-ci/test-environments/net-iso.yaml
-e $TRIPLEO_ROOT/tripleo-ci/test-environments/enable-tls-ipv6.yaml
-e $ENDPOINT_LIST_LOCATION/tls-endpoints-public-ip.yaml
-e $TRIPLEO_ROOT/tripleo-ci/test-environments/$CA_ENVIRONMENT_FILE
--ceph-storage-scale 1
-e /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml
-e $TRIPLEO_ROOT/tripleo-ci/test-environments/ceph-min-osds.yaml
"
# Disabling Telemetry after Newton, since we have scenario001 already covering it.
# https://bugs.launchpad.net/tripleo/+bug/1693174
if [ "$STABLE_RELEASE" != "newton" ]; then
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e /usr/share/openstack-tripleo-heat-templates/environments/disable-telemetry.yaml"
fi
OVERCLOUD_UPDATE_ARGS="-e /usr/share/openstack-tripleo-heat-templates/overcloud-resource-registry-puppet.yaml $OVERCLOUD_DEPLOY_ARGS"
NETISO_V6=1
PACEMAKER=1
elif [[ "$TOCI_JOBTYPE" =~ 'nonha-multinode-updates' ]] ; then
OVERCLOUD_UPDATE_ARGS="-e /usr/share/openstack-tripleo-heat-templates/overcloud-resource-registry-puppet.yaml $OVERCLOUD_DEPLOY_ARGS"
fi
;;
upgrades)
MAJOR_UPGRADE=1
if [ $TOCI_JOBTYPE == 'undercloud-upgrades' ] ; then
# We want to start by installing an Undercloud
# from the previous stable release.
if [ "$STABLE_RELEASE" = "queens" ]; then
STABLE_RELEASE=pike
elif [ "$STABLE_RELEASE" = "pike" ]; then
STABLE_RELEASE=ocata
elif [ "$STABLE_RELEASE" = "ocata" ]; then
STABLE_RELEASE=newton
elif [ "$STABLE_RELEASE" = "newton" ]; then
STABLE_RELEASE=mitaka
elif [ -z $STABLE_RELEASE ]; then
STABLE_RELEASE=pike
fi
UNDERCLOUD_MAJOR_UPGRADE=1
export UNDERCLOUD_SANITY_CHECK=1
fi
if [[ $TOCI_JOBTYPE =~ 'multinode-upgrades' ]] ; then
OVERCLOUD_MAJOR_UPGRADE=1
# We still bootstrap subnodes manually for multinode-upgrades
# because we are deploying Newton initially.
BOOTSTRAP_SUBNODES_MINIMAL=0
UNDERCLOUD_SSL=0
export UNDERCLOUD_SANITY_CHECK=0
if [[ $TOCI_JOBTYPE == 'multinode-upgrades' ]] ; then
export UPGRADE_ENV=/usr/share/openstack-tripleo-heat-templates/ci/environments/multinode_major_upgrade.yaml
else
export UPGRADE_ENV=/usr/share/openstack-tripleo-heat-templates/ci/environments/$MULTINODE_ENV_NAME.yaml
fi
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS --libvirt-type=qemu -t $OVERCLOUD_DEPLOY_TIMEOUT -r $TRIPLEO_ROOT/tripleo-ci/test-environments/upgrade_roles_data.yaml --overcloud-ssh-user $OVERCLOUD_SSH_USER --validation-errors-nonfatal"
fi
;;
ha)
NODECOUNT=4
# In ci our overcloud nodes don't have access to an external netwrok
# --ntp-server is here to make the deploy command happy, the ci env
# is on virt so the clocks should be in sync without it.
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS --control-scale 3 --ntp-server 0.centos.pool.ntp.org -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml -e $TRIPLEO_ROOT/tripleo-ci/test-environments/network-templates/network-isolation-absolute.yaml -e $TRIPLEO_ROOT/tripleo-ci/test-environments/network-templates/network-environment.yaml -e $TRIPLEO_ROOT/tripleo-ci/test-environments/net-iso.yaml"
if [ "$STABLE_RELEASE" != "newton" ]; then
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e /usr/share/openstack-tripleo-heat-templates/environments/disable-telemetry.yaml"
fi
NETISO_V4=1
PACEMAKER=1
PREDICTABLE_PLACEMENT=1
;;
nonha)
ENDPOINT_LIST_LOCATION=/usr/share/openstack-tripleo-heat-templates/environments
CA_ENVIRONMENT_FILE=inject-trust-anchor-hiera.yaml
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e $TRIPLEO_ROOT/tripleo-ci/test-environments/enable-tls.yaml -e $ENDPOINT_LIST_LOCATION/tls-endpoints-public-ip.yaml -e $TRIPLEO_ROOT/tripleo-ci/test-environments/$CA_ENVIRONMENT_FILE --ceph-storage-scale 1 -e /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml -e $TRIPLEO_ROOT/tripleo-ci/test-environments/ceph-min-osds.yaml"
if [ "$STABLE_RELEASE" != "newton" ]; then
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e /usr/share/openstack-tripleo-heat-templates/environments/disable-telemetry.yaml"
fi
INTROSPECT=1
NODECOUNT=3
UNDERCLOUD_SSL=1
UNDERCLOUD_TELEMETRY=1
UNDERCLOUD_UI=1
UNDERCLOUD_VALIDATIONS=1
;;
containers)
CONTAINERS=1
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS \
-e /usr/share/openstack-tripleo-heat-templates/environments/docker.yaml \
-e ~/containers-default-parameters.yaml"
;;
ovb)
OVB=1
# The test env broker needs to know the instanceid of the this node so it can attach it to the provisioning network
UCINSTANCEID=$(http_proxy= curl http://169.254.169.254/openstack/2015-10-15/meta_data.json | python -c 'import json, sys; print json.load(sys.stdin)["uuid"]')
;;
ipv6)
NETISO_V4=0
NETISO_V6=1
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation-v6.yaml -e $TRIPLEO_ROOT/tripleo-ci/test-environments/ipv6-network-templates/network-environment.yaml"
;;
convergence)
UNDERCLOUD_HEAT_CONVERGENCE=1
;;
multinode)
MULTINODE=1
TOCIRUNNER="./toci_instack_osinfra.sh"
OSINFRA=1
UNDERCLOUD_SSL=0
INTROSPECT=0
SUBNODES_SSH_KEY=/etc/nodepool/id_rsa
OVERCLOUD_DEPLOY_ARGS="--libvirt-type=qemu -t $OVERCLOUD_DEPLOY_TIMEOUT"
if [[ "$TOCI_JOBTYPE" =~ "3nodes" ]]; then
NODECOUNT=2
PACEMAKER=1
OVERCLOUD_ROLES="ControllerApi Controller"
export ControllerApi_hosts=$(sed -n 1,1p /etc/nodepool/sub_nodes_private)
export Controller_hosts=$(sed -n 2,2p /etc/nodepool/sub_nodes_private)
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/deployed-server-environment.yaml -e $TRIPLEO_ROOT/tripleo-ci/test-environments/multinode-3nodes.yaml --compute-scale 0 --overcloud-ssh-user $OVERCLOUD_SSH_USER --validation-errors-nonfatal -r /usr/share/openstack-tripleo-heat-templates/ci/environments/multinode-3nodes.yaml"
else
NODECOUNT=1
CONTROLLER_HOSTS=$(sed -n 1,1p /etc/nodepool/sub_nodes_private)
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e /usr/share/openstack-tripleo-heat-templates/environments/deployed-server-environment.yaml -e $MULTINODE_ENV_PATH --compute-scale 0 --overcloud-ssh-user $OVERCLOUD_SSH_USER --validation-errors-nonfatal"
fi
if [ "$STABLE_RELEASE" = "newton" ]; then
BOOTSTRAP_SUBNODES_MINIMAL=0
elif [[ $TOCI_JOBTYPE =~ 'multinode-upgrades' && "$STABLE_RELEASE" = "ocata" ]] ; then
# When doing a multinode upgrade test, an ocata test starts by installing
# newton, so we need to do the newton compatible bootstrap
BOOTSTRAP_SUBNODES_MINIMAL=0
else
BOOTSTRAP_SUBNODES_MINIMAL=1
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e /usr/share/openstack-tripleo-heat-templates/environments/deployed-server-bootstrap-environment-centos.yaml "
fi
;;
undercloud)
TOCIRUNNER="./toci_instack_osinfra.sh"
NODECOUNT=0
OVERCLOUD=0
OSINFRA=1
RUN_PING_TEST=0
INTROSPECT=0
UNDERCLOUD_SSL=1
UNDERCLOUD_TELEMETRY=1
UNDERCLOUD_UI=1
UNDERCLOUD_VALIDATIONS=1
export UNDERCLOUD_SANITY_CHECK=1
;;
periodic)
export DELOREAN_REPO_URL=https://trunk.rdoproject.org/centos7/consistent
export DELOREAN_STABLE_REPO_URL=https://trunk.rdoproject.org/centos7-$STABLE_RELEASE/consistent/
CACHEUPLOAD=1
OVERCLOUD_PINGTEST_ARGS=
;;
tempest)
export RUN_TEMPEST_TESTS=1
export RUN_PING_TEST=0
;;
oooq)
export OOOQ=1
if [[ "$TOCI_JOBTYPE" =~ "multinode" ]]; then
TOCIRUNNER="./toci_instack_oooq_multinode.sh"
else
TOCIRUNNER="./toci_instack_oooq.sh"
fi
PREDICTABLE_PLACEMENT=0
POSTCI=0
;;
fakeha)
NODECOUNT=2
# In ci our overcloud nodes don't have access to an external network
# --ntp-server is here to make the deploy command happy, the ci env
# is on virt so the clocks should be in sync without it.
OVERCLOUD_DEPLOY_ARGS="
$OVERCLOUD_DEPLOY_ARGS --control-scale 1
--ntp-server 0.centos.pool.ntp.org
-e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml
-e $TRIPLEO_ROOT/tripleo-ci/test-environments/network-templates/network-isolation-absolute.yaml
-e $TRIPLEO_ROOT/tripleo-ci/test-environments/network-templates/network-environment.yaml
-e $TRIPLEO_ROOT/tripleo-ci/test-environments/net-iso.yaml"
NETISO_V4=1
PACEMAKER=1
;;
caserver)
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e /usr/share/openstack-tripleo-heat-templates/environments/services/haproxy-public-tls-certmonger.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/tls-everywhere-endpoints-dns.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/enable-internal-tls.yaml"
# This is created in scripts/deploy.sh as part of the CA_SERVER
# section
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e $TRIPLEO_ROOT/cloud-names.yaml -e $TRIPLEO_ROOT/keystone-ldap.yaml"
CA_SERVER=1
DEPLOY_OVB_EXTRA_NODE=1
;;
esac
done
if [[ $PREDICTABLE_PLACEMENT == 1 ]]; then
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e $TRIPLEO_ROOT/tripleo-ci/test-environments/ips-from-pool-all.yaml -e $TRIPLEO_ROOT/tripleo-ci/test-environments/hostname-map.yaml -e $TRIPLEO_ROOT/tripleo-ci/test-environments/scheduler-hints.yaml"
fi
# Limit worker counts to avoid overloading our limited resources
if [[ "${OVERCLOUD_MAJOR_UPGRADE}" == "1" ]]; then
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e /usr/share/openstack-tripleo-heat-templates/environments/low-memory-usage.yaml"
else
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e $TRIPLEO_ROOT/tripleo-ci/test-environments/worker-config.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/low-memory-usage.yaml"
fi
# If we're running an update job, regenerate the args to reflect the above changes
if [ -n "$OVERCLOUD_UPDATE_ARGS" ]; then
OVERCLOUD_UPDATE_ARGS="-e /usr/share/openstack-tripleo-heat-templates/overcloud-resource-registry-puppet.yaml $OVERCLOUD_DEPLOY_ARGS"
# We need a shorter timeout for the update step. 80 minutes puts us past
# the gate timeout in most cases.
OVERCLOUD_UPDATE_ARGS=$(echo "$OVERCLOUD_UPDATE_ARGS" | sed "s/-t $OVERCLOUD_DEPLOY_TIMEOUT/-t $OVERCLOUD_UPDATE_TIMEOUT/")
fi
TIMEOUT_SECS=$((DEVSTACK_GATE_TIMEOUT*60))
# ./testenv-client kill everything in its own process group it it hits a timeout
# run it in a separate group to avoid getting killed along with it
set -m
if [ "$DEPLOY_OVB_EXTRA_NODE" = '1' ]; then
# This is usually done in the undercloud install, but we need it at this
# point since we want access to the extra node
if [ ! -f ~/.ssh/id_rsa ]; then
ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa
fi
SSH_KEY="$(cat ~/.ssh/id_rsa.pub)"
TEST_ENV_EXTRA_ARGS=("--create-undercloud" "--ssh-key" "$SSH_KEY")
else
TEST_ENV_EXTRA_ARGS=()
fi
source $TRIPLEO_ROOT/tripleo-ci/scripts/metrics.bash
start_metric "tripleo.testenv.${TOCI_JOBTYPE}.wait.seconds"
if [ -z "${TE_DATAFILE:-}" -a "$OSINFRA" = "0" ] ; then
# NOTE(pabelanger): We need gear for testenv, but this really should be
# handled by tox.
sudo pip install gear
# Kill the whole job if it doesn't get a testenv in 20 minutes as it likely will timout in zuul
( sleep 1200 ; [ ! -e /tmp/toci.started ] && sudo kill -9 $$ ) &
# TODO(bnemec): Add jobs that use public-bond
NETISO_ENV="none"
if [ $NETISO_V4 -eq 1 -o $NETISO_V6 -eq 1 ]; then
NETISO_ENV="multi-nic"
fi
if [ ${#TEST_ENV_EXTRA_ARGS[@]} -eq 0 ]; then
./testenv-client -b $GEARDSERVER:4730 -t $TIMEOUT_SECS \
--envsize $NODECOUNT --ucinstance $UCINSTANCEID \
--net-iso $NETISO_ENV -- $TOCIRUNNER
else
./testenv-client -b $GEARDSERVER:4730 -t $TIMEOUT_SECS \
--envsize $NODECOUNT --ucinstance $UCINSTANCEID \
--net-iso $NETISO_ENV "${TEST_ENV_EXTRA_ARGS[@]}" -- $TOCIRUNNER
fi
else
$TOCIRUNNER
fi
sudo unbound-control dump_cache > /tmp/dns_cache.txt
sudo chown ${USER}: /tmp/dns_cache.txt
cat /tmp/dns_cache.txt | gzip - > $WORKSPACE/logs/dns_cache.txt.gz
echo "tripleo.${STABLE_RELEASE:-master}.${TOCI_JOBTYPE}.logs.size_mb" "$(du -sm $WORKSPACE/logs | awk {'print $1'})" "$(date +%s)" | nc 66.187.229.172 2003 || true

View File

@ -1 +0,0 @@
toci_gate_test-oooq.sh

297
toci_gate_test.sh Executable file
View File

@ -0,0 +1,297 @@
#!/usr/bin/env bash
source $(dirname $0)/scripts/common_vars.bash
source $(dirname $0)/scripts/common_functions.sh
set -eux
export START_JOB_TIME=$(date +%s)
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
source $TRIPLEO_ROOT/tripleo-ci/scripts/oooq_common_functions.sh
if [ -f /etc/nodepool/provider ] ; then
# this sets
# NODEPOOL_PROVIDER (e.g tripleo-test-cloud-rh1)
# NODEPOOL_CLOUD (e.g.tripleo-test-cloud-rh1)
# NODEPOOL_REGION (e.g. regionOne)
# NODEPOOL_AZ
source /etc/nodepool/provider
# source variables common across all the scripts.
source /etc/ci/mirror_info.sh
export RHCLOUD=''
if [ ${NODEPOOL_PROVIDER:-''} == 'rdo-cloud-tripleo' ]; then
RHCLOUD='rdocloud'
source $(dirname $0)/scripts/$RHCLOUD.env
# In order to save space remove the cached git repositories, at this point in
# CI the ones we are interested in have been cloned to /opt/stack/new. We
# can also remove some distro images cached on the images.
sudo rm -rf /opt/git
fi
fi
# default $NODEPOOL_PROVIDER if not already set as it's used later
export NODEPOOL_PROVIDER=${NODEPOOL_PROVIDER:-""}
# Set job as failed until it's overwritten by pingtest/tempest real test subunit
cat $TRIPLEO_ROOT/tripleo-ci/scripts/fake_fail_subunit | gzip - > $WORKSPACE/logs/testrepository.subunit.gz
# NOTE(trown): In openstack-infra we have pip already, but this will ensure we
# have it available in other environments.
command -v pip || \
(curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"; sudo python get-pip.py)
sudo yum -y install python-requests python-urllib3
sudo pip install shyaml
# Sets whether or not this job will upload images.
export PERIODIC=0
# Sets which repositories to use in the job
export QUICKSTART_RELEASE="${STABLE_RELEASE:-master}"
# Stores OVB undercloud instance id
export UCINSTANCEID="null"
# Define environment variables file
export ENV_VARS=""
# Define file with set of features to test
export FEATURESET_FILE=""
export FEATURESET_CONF=""
# Define file with nodes topology
export NODES_FILE=""
# Set the number of overcloud nodes
export NODECOUNT=0
# Sets the undercloud hostname
export UNDERCLOUD=""
# Select the tags to run
export TAGS=all
# Identify in which environment we're deploying
export ENVIRONMENT=""
# Set the overcloud hosts for multinode
export OVERCLOUD_HOSTS=
export CONTROLLER_HOSTS=
export SUBNODES_SSH_KEY=
TIMEOUT_SECS=$((DEVSTACK_GATE_TIMEOUT*60))
export EXTRA_VARS=${EXTRA_VARS:-""}
export NODES_ARGS=""
export EXTRANODE=""
# Set playbook execution status
export PLAYBOOK_DRY_RUN=${PLAYBOOK_DRY_RUN:=0}
export COLLECT_CONF="$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/collect-logs.yml"
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
featureset*)
FEATURESET_FILE="$LWD/config/general_config/$JOB_TYPE_PART.yml"
FEATURESET_CONF="$FEATURESET_CONF --extra-vars @$FEATURESET_FILE"
MIXED_UPGRADE_TYPE=''
# Order matters. ffu featureset has both mixed version and ffu_overcloud_upgrade.
if is_featureset ffu_overcloud_upgrade "$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/$JOB_TYPE_PART.yml"; then
MIXED_UPGRADE_TYPE='ffu_upgrade'
elif is_featureset mixed_upgrade "$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/$JOB_TYPE_PART.yml"; then
MIXED_UPGRADE_TYPE='mixed_upgrade'
elif is_featureset overcloud_update "$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/$JOB_TYPE_PART.yml"; then
TAGS="$TAGS,overcloud-update"
elif is_featureset undercloud_upgrade "$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/$JOB_TYPE_PART.yml"; then
TAGS="$TAGS,undercloud-upgrade"
export UPGRADE_RELEASE=$QUICKSTART_RELEASE
export QUICKSTART_RELEASE=$(previous_release_mixed_upgrade_case "${UPGRADE_RELEASE}")
fi
# Set UPGRADE_RELEASE if applicable
if [ -n "${MIXED_UPGRADE_TYPE}" ]; then
export UPGRADE_RELEASE=$(previous_release_from "${STABLE_RELEASE}" "${MIXED_UPGRADE_TYPE}")
QUICKSTART_RELEASE="$QUICKSTART_RELEASE-undercloud-$UPGRADE_RELEASE-overcloud"
# Run overcloud-upgrade tag only in upgrades jobs
TAGS="$TAGS,overcloud-upgrade"
fi
;;
ovb)
OVB=1
ENVIRONMENT="ovb"
UCINSTANCEID=$(http_proxy= curl http://169.254.169.254/openstack/2015-10-15/meta_data.json | python -c 'import json, sys; print json.load(sys.stdin)["uuid"]')
if [[ " $QUICKSTART_SH_JOBS " =~ " $TOCI_JOBTYPE " ]]; then
export PLAYBOOKS=${PLAYBOOKS:-"baremetal-full-deploy.yml"}
else
export PLAYBOOKS=${PLAYBOOKS:-"ovb-setup.yml baremetal-full-undercloud.yml baremetal-full-overcloud-prep.yml baremetal-full-overcloud.yml baremetal-full-overcloud-validate.yml"}
fi
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/ovb.yml"
if [[ -f "$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/ovb-$RHCLOUD.yml" ]]; then
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/ovb-$RHCLOUD.yml"
fi
UNDERCLOUD="undercloud"
;;
multinode)
SUBNODES_SSH_KEY=/etc/nodepool/id_rsa
ENVIRONMENT="osinfra"
if [[ " $QUICKSTART_SH_JOBS " =~ " $TOCI_JOBTYPE " ]]; then
export PLAYBOOKS=${PLAYBOOKS:-"multinode.yml"}
else
export PLAYBOOKS=${PLAYBOOKS:-"quickstart.yml multinode-undercloud.yml multinode-overcloud-prep.yml multinode-overcloud.yml multinode-overcloud-update.yml multinode-overcloud-upgrade.yml multinode-validate.yml"}
fi
FEATURESET_CONF=" --extra-vars @$LWD/config/general_config/featureset-multinode-common.yml $FEATURESET_CONF"
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/multinode.yml"
if [[ $NODEPOOL_PROVIDER == "rdo-cloud-tripleo" ]]; then
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/multinode-rdocloud.yml"
fi
UNDERCLOUD="127.0.0.2"
TAGS="build,undercloud-setup,undercloud-scripts,undercloud-install,undercloud-post-install,tripleo-validations,overcloud-scripts,overcloud-prep-config,overcloud-prep-containers,overcloud-deploy,overcloud-post-deploy,overcloud-validate"
CONTROLLER_HOSTS=$(sed -n 1,1p /etc/nodepool/sub_nodes_private)
OVERCLOUD_HOSTS=$(cat /etc/nodepool/sub_nodes_private)
;;
singlenode)
ENVIRONMENT="osinfra"
UNDERCLOUD="127.0.0.2"
if [[ " $QUICKSTART_SH_JOBS " =~ " $TOCI_JOBTYPE " ]]; then
export PLAYBOOKS=${PLAYBOOKS:-"multinode.yml"}
else
export PLAYBOOKS=${PLAYBOOKS:-"quickstart.yml multinode-undercloud.yml multinode-undercloud-upgrade.yml multinode-overcloud-prep.yml multinode-overcloud.yml multinode-overcloud-upgrade.yml multinode-validate.yml"}
fi
FEATURESET_CONF=" --extra-vars @$LWD/config/general_config/featureset-multinode-common.yml $FEATURESET_CONF"
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/multinode.yml"
if [[ $NODEPOOL_PROVIDER == "rdo-cloud-tripleo" ]]; then
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/multinode-rdocloud.yml"
fi
TAGS="build,undercloud-setup,undercloud-scripts,undercloud-install,undercloud-validate,images"
;;
standalone)
ENVIRONMENT="osinfra"
UNDERCLOUD="127.0.0.2"
export PLAYBOOKS=${PLAYBOOKS:-"quickstart.yml multinode-standalone.yml"}
FEATURESET_CONF=" --extra-vars @$LWD/config/general_config/featureset-multinode-common.yml $FEATURESET_CONF"
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/multinode.yml"
if [[ $NODEPOOL_PROVIDER == "rdo-cloud-tripleo" ]]; then
ENV_VARS="$ENV_VARS --extra-vars @$TRIPLEO_ROOT/tripleo-ci/toci-quickstart/config/testenv/multinode-rdocloud.yml"
fi
TAGS="build,standalone"
;;
periodic)
PERIODIC=1
QUICKSTART_RELEASE="promotion-testing-hash-${QUICKSTART_RELEASE}"
;;
gate)
;;
dryrun)
PLAYBOOK_DRY_RUN=1
;;
*)
# the rest should be node configuration
NODES_FILE="$TRIPLEO_ROOT/tripleo-quickstart/config/nodes/$JOB_TYPE_PART.yml"
;;
esac
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)
popd
NODES_ARGS="--extra-vars @$NODES_FILE"
for PART in $(sed 's/_/ /g' <<< "$NODES_FILE") ; do
if [[ "$PART" == *"supp"* ]]; then
EXTRANODE=" --extra-nodes ${PART//[!0-9]/} "
fi;
done
fi
# Import gated tripleo-upgrade in oooq for upgrades/updates jobs
if [[ -d $TRIPLEO_ROOT/tripleo-upgrade ]]; then
echo "file://${TRIPLEO_ROOT}/tripleo-upgrade/#egg=tripleo-upgrade" >> ${TRIPLEO_ROOT}/tripleo-quickstart/quickstart-extras-requirements.txt
else
# Otherwise, if not importing it, oooq will fail when loading
# tripleo-upgrade role in the playbook.
echo "git+https://git.openstack.org/openstack/tripleo-upgrade.git@${ZUUL_BRANCH}#egg=tripleo-upgrade" >> ${TRIPLEO_ROOT}/tripleo-quickstart/quickstart-extras-requirements.txt
fi
# Start time tracking
export STATS_TESTENV=$(date +%s)
pushd $TRIPLEO_ROOT/tripleo-ci
if [ -z "${TE_DATAFILE:-}" -a "$ENVIRONMENT" = "ovb" ] ; then
export GEARDSERVER=${TEBROKERIP-192.168.1.1}
# NOTE(pabelanger): We need gear for testenv, but this really should be
# handled by tox.
sudo pip install gear
# Kill the whole job if it doesn't get a testenv in 20 minutes as it likely will timout in zuul
( sleep 1200 ; [ ! -e /tmp/toci.started ] && sudo kill -9 $$ ) &
# We only support multi-nic at the moment
NETISO_ENV="multi-nic"
# provision env in rh cloud, then start quickstart
./testenv-client -b $GEARDSERVER:4730 -t $TIMEOUT_SECS \
--envsize $NODECOUNT --ucinstance $UCINSTANCEID \
--net-iso $NETISO_ENV $EXTRANODE -- ./toci_quickstart.sh
elif [ "$ENVIRONMENT" = "ovb" ] ; then
# We only support multi-nic at the moment
NETISO_ENV="multi-nic"
./toci_quickstart.sh
else
# Copy nodepool keys to current user
sudo cp /etc/nodepool/id_rsa* $HOME/.ssh/
sudo chown $USER:$USER $HOME/.ssh/id_rsa*
chmod 0600 $HOME/.ssh/id_rsa*
cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
# pre-ansible requirement
sudo mkdir -p /root/.ssh/
# everything below here *MUST* be translated to a role ASAP
# empty image to fool overcloud deployment
# set no_proxy variable
export IP_DEVICE=${IP_DEVICE:-"eth0"}
MY_IP=$(ip addr show dev $IP_DEVICE | awk '/inet / {gsub("/.*", "") ; print $2}')
MY_IP_eth1=$(ip addr show dev eth1 | awk '/inet / {gsub("/.*", "") ; print $2}') || MY_IP_eth1=""
export http_proxy=""
undercloud_net_range="192.168.24."
undercloud_services_ip=$undercloud_net_range"1"
undercloud_haproxy_public_ip=$undercloud_net_range"2"
undercloud_haproxy_admin_ip=$undercloud_net_range"3"
export no_proxy=$undercloud_services_ip,$undercloud_haproxy_public_ip,$undercloud_haproxy_admin_ip,$MY_IP,$MY_IP_eth1
# multinode bootstrap script
export DO_BOOTSTRAP_SUBNODES=${DO_BOOTSTRAP_SUBNODES:-1}
export BOOTSTRAP_SUBNODES_MINIMAL=1
overcloud_release=${UPGRADE_RELEASE:-$STABLE_RELEASE}
if [ "${overcloud_release}" = "newton" ]; then
BOOTSTRAP_SUBNODES_MINIMAL=0
fi
echo_vars_to_deploy_env_oooq
subnodes_scp_deploy_env
if [ "$DO_BOOTSTRAP_SUBNODES" = "1" ]; then
$TRIPLEO_ROOT/tripleo-ci/scripts/tripleo.sh \
--bootstrap-subnodes \
2>&1 | awk '{ print strftime("%Y-%m-%d %H:%M:%S |"), $0; fflush(); }' | sudo tee /var/log/bootstrap-subnodes.log \
|| (tail -n 50 /var/log/bootstrap-subnodes.log && false)
fi
# finally, run quickstart
./toci_quickstart.sh
fi
echo "Run completed"
echo "tripleo.${STABLE_RELEASE:-master}.${TOCI_JOBTYPE}.logs.size_mb" "$(du -sm $WORKSPACE/logs | awk {'print $1'})" "$(date +%s)" | nc 66.187.229.172 2003 || true

View File

@ -1,175 +0,0 @@
#!/usr/bin/env bash
set -eux
set -o pipefail
export CURRENT_DIR=$(dirname ${BASH_SOURCE[0]:-$0})
export TRIPLEO_CI_DIR=$CURRENT_DIR/../
export IP_DEVICE=${IP_DEVICE:-"eth0"}
source $TRIPLEO_CI_DIR/tripleo-ci/scripts/common_vars.bash
source $TRIPLEO_CI_DIR/tripleo-ci/scripts/common_functions.sh
source $TRIPLEO_CI_DIR/tripleo-ci/scripts/metrics.bash
start_metric "tripleo.${STABLE_RELEASE:-master}.${TOCI_JOBTYPE}.ci.total.seconds"
mkdir -p $WORKSPACE/logs
MY_IP=$(ip addr show dev $IP_DEVICE | awk '/inet / {gsub("/.*", "") ; print $2}')
MY_IP_eth1=$(ip addr show dev eth1 | awk '/inet / {gsub("/.*", "") ; print $2}') || MY_IP_eth1=""
export http_proxy=""
undercloud_net_range="192.168.24."
undercloud_services_ip=$undercloud_net_range"1"
undercloud_haproxy_public_ip=$undercloud_net_range"2"
undercloud_haproxy_admin_ip=$undercloud_net_range"3"
export no_proxy=$undercloud_services_ip,$undercloud_haproxy_public_ip,$undercloud_haproxy_admin_ip,$MY_IP,$MY_IP_eth1
# Copy nodepool ssh keys for the current user because apparently id_rsa.pub is
# missing from ~/.ssh
cp /etc/nodepool/id_rsa ~/.ssh/
cp /etc/nodepool/id_rsa.pub ~/.ssh/
# Remove the anything on the infra image template that might interfere with CI
# Note for tripleo-quickstart: this task is already managed in tripleo-ci-setup-playbook.yml
sudo yum remove -y facter puppet hiera puppetlabs-release rdo-release centos-release-[a-z]*
sudo rm -rf /etc/puppet /etc/hiera.yaml
# Setup delorean
$TRIPLEO_ROOT/tripleo-ci/scripts/tripleo.sh --delorean-setup
dummy_ci_repo
# Install all of the repositories we need
$TRIPLEO_ROOT/tripleo-ci/scripts/tripleo.sh --repo-setup
# Install some useful/necessary packages
# TODO(amoralej): remove after https://review.openstack.org/#/c/468872/ is merged
sudo pip uninstall certifi -y || true
sudo pip uninstall urllib3 -y || true
sudo pip uninstall requests -y || true
sudo rpm -e --nodeps python2-certifi || :
sudo rpm -e --nodeps python2-urllib3 || :
sudo rpm -e --nodeps python2-requests || :
sudo yum -y install python-requests python-urllib3
# Open up port for delorean yum repo server
sudo iptables -I INPUT -p tcp --dport 8766 -j ACCEPT
trap "exit_val=\$?; [ \$exit_val != 0 ] && echo ERROR DURING PREVIOUS COMMAND ^^^ && echo 'See postci.txt in the logs directory for debugging details'; postci \$exit_val 2>&1 | awk '{ print strftime(\"%Y-%m-%d %H:%M:%S.000\"), \"|\", \$0; fflush(); }' > $WORKSPACE/logs/postci.log 2>&1; stop_dstat" EXIT
# Tempreverts/cherry-picks/pins go here. For example:
# temprevert tripleo-common af27127508eabf2b6873713e5e1507fa92b5f5b3 1623606
delorean_build_and_serve
# Since we've moved a few commands from this spot before the wget, we need to
# sleep a few seconds in order for the SimpleHTTPServer to get setup.
sleep 3
layer_ci_repo
echo_vars_to_deploy_env
# We need to override $OVERCLOUD_VALIDATE_ARGS to be empty so that the
# validations that check for the correct number of ironic nodes does not fail
# the deploy.
echo 'export OVERCLOUD_VALIDATE_ARGS=""' >> $TRIPLEO_ROOT/tripleo-ci/deploy.env
source $TRIPLEO_ROOT/tripleo-ci/deploy.env
# TODO: remove later, this is for live debugging
sudo cat /etc/nodepool/*
if [ -s /etc/nodepool/sub_nodes_private ]; then
for ip in $(cat /etc/nodepool/sub_nodes_private); do
sanitized_address=$(sanitize_ip_address $ip)
ssh $SSH_OPTIONS -tt -i /etc/nodepool/id_rsa $ip \
sudo yum remove -y facter puppet hiera puppetlabs-release rdo-release centos-release-[a-z]*
ssh $SSH_OPTIONS -tt -i /etc/nodepool/id_rsa $ip \
sudo rm -rf /etc/puppet /etc/hiera.yaml
ssh $SSH_OPTIONS -tt -i /etc/nodepool/id_rsa $ip \
sudo yum -y install wget
ssh $SSH_OPTIONS -tt -i /etc/nodepool/id_rsa $ip \
sudo wget http://$MY_IP:8766/current/delorean-ci.repo -O /etc/yum.repos.d/delorean-ci.repo
ssh $SSH_OPTIONS -tt -i /etc/nodepool/id_rsa $ip \
sudo sed -i -e \"s%baseurl=.*%baseurl=http://$MY_IP:8766/current/%\" /etc/yum.repos.d/delorean-ci.repo
ssh $SSH_OPTIONS -tt -i /etc/nodepool/id_rsa $ip \
sudo sed -i -e 's%priority=.*%priority=1%' /etc/yum.repos.d/delorean-ci.repo
ssh $SSH_OPTIONS -tt -i /etc/nodepool/id_rsa $ip \
sudo mkdir -p $TRIPLEO_ROOT/tripleo-ci
scp $SSH_OPTIONS -i /etc/nodepool/id_rsa \
$TRIPLEO_ROOT/tripleo-ci/deploy.env ${sanitized_address}:
ssh $SSH_OPTIONS -tt -i /etc/nodepool/id_rsa $ip \
sudo cp deploy.env $TRIPLEO_ROOT/tripleo-ci/deploy.env
done
subnodes_scp_deploy_env
if [ "$OVERCLOUD_MAJOR_UPGRADE" = "1" ]; then
# If upgrading the overcloud, we want to bootstrap the subnodes at the
# release defined by $UPGRADE_RELEASE
# Save the current value of $STABLE_RELEASE
CURR_STABLE_RELEASE=$STABLE_RELEASE
# Set $STABLE_RELEASE to the release at which we want to start the subnodes
STABLE_RELEASE=$UPGRADE_RELEASE
# Update and copy deploy.env to the subnodes
echo_vars_to_deploy_env
subnodes_scp_deploy_env
# Reset $STABLE_RELEASE
STABLE_RELEASE=$CURR_STABLE_RELEASE
# Update the local deploy.env only so that the undercloud will install
# at the current $STABLE_RELEASE
echo_vars_to_deploy_env
# Disable the delorean-ci repo for the initial overcloud deploy, as
# ZUUL_REFS, and thus the contents of delorean-ci can only reference
# patches for the current branch, not UPGRADE_RELEASE
if [ -s /etc/nodepool/sub_nodes_private ]; then
for ip in $(cat /etc/nodepool/sub_nodes_private); do
ssh $SSH_OPTIONS -tt -i /etc/nodepool/id_rsa $ip \
sudo sed -i -e \"s/enabled=1/enabled=0/\" /etc/yum.repos.d/delorean-ci.repo
done
fi
fi
$TRIPLEO_ROOT/tripleo-ci/scripts/tripleo.sh --multinode-setup
echo "INFO: Check /var/log/boostrap-subnodes.log for boostrap subnodes output"
if [ "$DO_BOOTSTRAP_SUBNODES" = "1" ]; then
$TRIPLEO_ROOT/tripleo-ci/scripts/tripleo.sh --bootstrap-subnodes 2>&1 | sudo dd of=/var/log/bootstrap-subnodes.log || (tail -n 50 /var/log/bootstrap-subnodes.log && false)
fi
# This needs to be done after the --multinode-setup otherwise /etc/hosts will
# get overwritten
hosts=$(mktemp)
cat >$hosts<<EOF
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
EOF
for ip in $(cat /etc/nodepool/sub_nodes_private); do
sanitized_address=$(sanitize_ip_address $ip)
scp $SSH_OPTIONS -i /etc/nodepool/id_rsa $hosts ${sanitized_address}:hosts
ssh $SSH_OPTIONS -tt -i /etc/nodepool/id_rsa $ip \
sudo cp hosts /etc/hosts
done
fi
# Install our test cert so SSL tests work
sudo cp $TRIPLEO_ROOT/tripleo-ci/test-environments/overcloud-cacert.pem /etc/pki/ca-trust/source/anchors/
sudo cp $TRIPLEO_ROOT/tripleo-ci/test-environments/overcloud-cacert-ipv6.pem /etc/pki/ca-trust/source/anchors/
sudo update-ca-trust extract
# The mitaka branch of instack-undercloud does not have the net-config override
# feature, so we need to add a dummy interface so that os-net-config can
# add it to the br-ctlplane bridge.
if [ "$STABLE_RELEASE" = "mitaka" ]; then
if ! ip link show ci-dummy; then
sudo ip link add ci-dummy type dummy
fi
fi
# Use $REMAINING_TIME of infra to calculate maximum time for remaning part of job
# Leave 10 minutes for postci function
REMAINING_TIME=${REMAINING_TIME:-180}
TIME_FOR_DEPLOY=$(( REMAINING_TIME - ($(date +%s) - START_JOB_TIME)/60 - 10 ))
/usr/bin/timeout --preserve-status ${TIME_FOR_DEPLOY}m $TRIPLEO_ROOT/tripleo-ci/scripts/deploy.sh
exit 0
echo 'Run completed.'

View File

@ -1,119 +0,0 @@
#!/usr/bin/env bash
set -eux
## Signal to toci_gate_test.sh we've started
touch /tmp/toci.started
export CURRENT_DIR=$(dirname ${BASH_SOURCE[0]:-$0})
export TRIPLEO_CI_DIR=$CURRENT_DIR/../
export IP_DEVICE=${IP_DEVICE:-"eth0"}
export ZUUL_PROJECT=${ZUUL_PROJECT:-""}
export CA_SERVER=${CA_SERVER:-""}
source $TRIPLEO_CI_DIR/tripleo-ci/scripts/common_vars.bash
source $TRIPLEO_CI_DIR/tripleo-ci/scripts/common_functions.sh
source $TRIPLEO_CI_DIR/tripleo-ci/scripts/metrics.bash
stop_metric "tripleo.testenv.${TOCI_JOBTYPE}.wait.seconds" # start_metric in toci_gate_test.sh
start_metric "tripleo.${STABLE_RELEASE:-master}.${TOCI_JOBTYPE}.ci.total.seconds"
mkdir -p $WORKSPACE/logs
MY_IP=$(ip addr show dev $IP_DEVICE | awk '/inet / {gsub("/.*", "") ; print $2}')
# TODO: Set undercloud_hostname in undercloud.conf
hostname | sudo dd of=/etc/hostname
echo "127.0.0.1 $(hostname) $(hostname).openstacklocal" | sudo tee -a /etc/hosts
# TODO: xfsprogs should be a dep of DIB?
sudo yum install -y xfsprogs
# Remove the anything on the infra image template that might interfere with CI
# Note for tripleo-quickstart: this task is already managed in tripleo-ci-setup-playbook.yml
sudo yum remove -y facter puppet hiera puppetlabs-release rdo-release centos-release-[a-z]*
sudo rm -rf /etc/puppet /etc/hiera.yaml
undercloud_net_range="192.168.24."
undercloud_services_ip=$undercloud_net_range"1"
undercloud_haproxy_public_ip=$undercloud_net_range"2"
undercloud_haproxy_admin_ip=$undercloud_net_range"3"
export no_proxy=$undercloud_services_ip,$undercloud_haproxy_public_ip,$undercloud_haproxy_admin_ip,$MY_IP,$MIRRORSERVER
# Setup delorean
$TRIPLEO_ROOT/tripleo-ci/scripts/tripleo.sh --delorean-setup
dummy_ci_repo
# Install all of the repositories we need
$TRIPLEO_ROOT/tripleo-ci/scripts/tripleo.sh --repo-setup
# Will be used by the undercloud and needed for the TLS everywhere job
sudo yum install -y jq
# We can't use squid to cache https urls, so don't use them
for i in /etc/yum.repos.d/delorean*
do
# NOTE(bnemec): It seems that using http urls for CBS repos causes a lot
# of spurious failures due to the forced redirect to https. Limit this
# to only the delorean repos that actually allow http access.
sudo sed -i 's|https://trunk.rdoproject.org|http://trunk.rdoproject.org|g' $i
done
# Install some useful/necessary packages
sudo yum -y install wget python-simplejson yum-plugin-priorities qemu-img
trap "exit_val=\$?; [ \$exit_val != 0 ] && echo ERROR DURING PREVIOUS COMMAND ^^^ && echo 'See postci.txt in the logs directory for debugging details'; postci \$exit_val 2>&1 | awk '{ print strftime(\"%Y-%m-%d %H:%M:%S.000\"), \"|\", \$0; fflush(); }' > $WORKSPACE/logs/postci.log 2>&1; stop_dstat" EXIT
# Tempreverts/cherry-picks/pins go here. For example:
# temprevert tripleo-common af27127508eabf2b6873713e5e1507fa92b5f5b3 1623606
delorean_build_and_serve
# Since we've moved a few commands from this spot before the wget, we need to
# sleep a few seconds in order for the SimpleHTTPServer to get setup.
sleep 3
layer_ci_repo
echo_vars_to_deploy_env
source $TRIPLEO_ROOT/tripleo-ci/deploy.env
# Install our test cert so SSL tests work
sudo cp $TRIPLEO_ROOT/tripleo-ci/test-environments/overcloud-cacert.pem /etc/pki/ca-trust/source/anchors/
sudo cp $TRIPLEO_ROOT/tripleo-ci/test-environments/overcloud-cacert-ipv6.pem /etc/pki/ca-trust/source/anchors/
sudo update-ca-trust extract
# Don't get a file from cache if CACHEUPLOAD=1 (periodic job)
# If this 404's it wont error just continue without a file created
if canusecache ironic-python-agent.tar ; then
wget --progress=dot:mega http://$MIRRORSERVER/builds-${STABLE_RELEASE:-master}/current-tripleo${STABLE_RELEASE:+-$STABLE_RELEASE}/ironic-python-agent.tar || true
if [ -f ironic-python-agent.tar ] ; then
tar -xf ironic-python-agent.tar
update_image $PWD/ironic-python-agent.initramfs
rm ironic-python-agent.tar
mv ironic-python-agent.* ~
fi
fi
# Same thing for the overcloud image
if canusecache overcloud-full.tar ; then
wget --progress=dot:mega http://$MIRRORSERVER/builds-${STABLE_RELEASE:-master}/current-tripleo${STABLE_RELEASE:+-$STABLE_RELEASE}/overcloud-full.tar || true
if [ -f overcloud-full.tar ] ; then
tar -xf overcloud-full.tar
update_image $PWD/overcloud-full.qcow2
mv overcloud-full.qcow2 overcloud-full.initrd overcloud-full.vmlinuz ~
rm overcloud-full.tar
fi
fi
cp -f $TE_DATAFILE ~/instackenv.json
# Use $REMAINING_TIME of infra to calculate maximum time for remaning part of job
# Leave 10 minutes for postci function
REMAINING_TIME=${REMAINING_TIME:-180}
TIME_FOR_DEPLOY=$(( REMAINING_TIME - ($(date +%s) - START_JOB_TIME)/60 - 10 ))
/usr/bin/timeout --preserve-status ${TIME_FOR_DEPLOY}m $TRIPLEO_ROOT/tripleo-ci/scripts/deploy.sh
echo 'Run completed.'