#!/bin/bash -ex # Copyright 2015 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. export PATH=$PATH:/usr/local/sbin:/usr/sbin SCENARIO=${SCENARIO:-scenario001} BRANCH=queens # We could want to override the default repositories or install behavior INSTALL_FROM_SOURCE=${INSTALL_FROM_SOURCE:-true} MANAGE_REPOS=${MANAGE_REPOS:-true} DELOREAN=${DELOREAN:-https://trunk.rdoproject.org/centos7-queens/current-passed-ci/delorean.repo} DELOREAN_DEPS=${DELOREAN_DEPS:-https://trunk.rdoproject.org/centos7-queens/delorean-deps.repo} GIT_BASE_URL=${GIT_BASE_URL:-https://git.openstack.org} ADDITIONAL_ARGS=${ADDITIONAL_ARGS:-} SELINUX_ENFORCING=${SELINUX_ENFORCING:-true} # If logs should be retrieved automatically COPY_LOGS=${COPY_LOGS:-true} # Let's add an option for a secondary node, to act as a compute CONTROLLER_NODE=${CONTROLLER_NODE:-} COMPUTE_NODE=${COMPUTE_NODE:-} # Install external Puppet modules with r10k # Uses the following variables: # # - ``GEM_BIN_DIR`` must be set to Gem bin directory # - ``PUPPETFILE_DIR`` must be set to Puppet modules directory install_external() { $SUDO ${GEM_BIN_DIR}r10k puppetfile install -v --moduledir ${PUPPETFILE_DIR} --puppetfile Puppetfile1 } # Install Puppet OpenStack modules with zuul-cloner # Uses the following variables: # # - ``PUPPETFILE_DIR`` must be set to Puppet modules directory # - ``ZUUL_REF`` must be set to Zuul ref. Fallback to 'None'. # - ``ZUUL_BRANCH`` must be set to Zuul branch. Fallback to 'master'. install_openstack() { cat > clonemap.yaml < /etc/puppet/puppet.conf < /etc/puppet/hiera.yaml </dev/null; then $SUDO dstat -tcmndrylpg \ --top-cpu-adv \ --top-io-adv \ --nocolor | $SUDO tee -a /var/log/dstat.log > /dev/null & fi # Setup packstack if [ "${INSTALL_FROM_SOURCE}" = true ]; then # pycparser 2.19 seems to have trouble with older setuptools versions $SUDO pip install pycparser==2.18 $SUDO pip install --ignore-installed -c https://opendev.org/openstack/requirements/raw/branch/stable/$BRANCH/upper-constraints.txt . export GEM_BIN_DIR=/tmp/packstackgems/bin/ export PUPPETFILE_DIR=/usr/share/openstack-puppet/modules export GEM_HOME=/tmp/packstackgems # puppet_forge 2.2.7 has a dependency on semantic_puppet ~> 1.0 # which is not compatible with dependency of latest r10k on semantic_puppet ~> 0.1.0 $SUDO gem install puppet_forge -v '= 2.2.6' $SUDO gem install r10k -v 2.6.4 --no-ri --no-rdoc # make sure there is no puppet module pre-installed $SUDO rm -rf "${PUPPETFILE_DIR:?}/"* install_modules else $SUDO yum -y install openstack-packstack fi # Make sure there are no other puppet modules in the system (happens in gate) $SUDO rm -rf /etc/puppet/modules/* # Make sure the fqdn is associated to the IP in /etc/hosts # Needed for Horizon SSL tests in Tempest echo -e "\n127.0.0.1 $(facter fqdn)" | $SUDO tee -a /etc/hosts # Generate configuration from selected scenario and run it source ./tests/${SCENARIO}.sh result=$? # Print output and generate subunit if results exist if [ -d /var/lib/tempest ]; then pushd /var/lib/tempest if [ -d .testrepository ]; then $SUDO /usr/bin/testr last || true $SUDO bash -c "/usr/bin/testr last --subunit > /var/tmp/packstack/latest/testrepository.subunit" || true elif [ -d .stestr ]; then $SUDO /usr/bin/stestr last || true $SUDO bash -c "/usr/bin/stestr last --subunit > /var/tmp/packstack/latest/testrepository.subunit" || true fi popd fi if [ "${COPY_LOGS}" = true ]; then source ./tools/copy-logs.sh recover_default_logs fi if [ "${FAILURE}" = true ]; then exit 1 fi exit $result