123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- export PATH=$PATH:/usr/local/sbin:/usr/sbin
- SCENARIO=${SCENARIO:-scenario001}
- INSTALL_FROM_SOURCE=${INSTALL_FROM_SOURCE:-true}
- MANAGE_REPOS=${MANAGE_REPOS:-true}
- DELOREAN=${DELOREAN:-http://trunk.rdoproject.org/centos7-master/current-passed-ci/delorean.repo}
- DELOREAN_DEPS=${DELOREAN_DEPS:-http://trunk.rdoproject.org/centos7-master/delorean-deps.repo}
- GIT_BASE_URL=${GIT_BASE_URL:-git://git.openstack.org}
- ADDITIONAL_ARGS=${ADDITIONAL_ARGS:-}
- COPY_LOGS=${COPY_LOGS:-true}
- install_external() {
- $SUDO ${GEM_BIN_DIR}r10k puppetfile install -v --moduledir ${PUPPETFILE_DIR} --puppetfile Puppetfile1
- }
- install_openstack() {
- cat > clonemap.yaml <<EOF
- clonemap:
- - name: '(.*?)/puppet-(.*)'
- dest: '$PUPPETFILE_DIR/\2'
- EOF
-
- ZUUL_REF=${ZUUL_REF:-None}
- ZUUL_BRANCH=${ZUUL_BRANCH:-master}
- local project_names=$(awk '{ if ($1 == ":git") print $3 }' \
- Puppetfile0 | tr -d "'," | cut -d '/' -f 4- | xargs
- )
- $SUDO /usr/zuul-env/bin/zuul-cloner -m clonemap.yaml \
- --cache-dir /opt/git \
- --zuul-ref $ZUUL_REF \
- --zuul-branch $ZUUL_BRANCH \
- --zuul-url $ZUUL_URL \
- $GIT_BASE_URL $project_names
- }
- install_all() {
- $SUDO ${GEM_BIN_DIR}r10k puppetfile install -v --puppetfile Puppetfile
- }
- install_modules() {
-
- if [ -e /usr/zuul-env/bin/zuul-cloner ] ; then
- csplit Puppetfile /'Non-OpenStack modules'/ \
- --prefix Puppetfile \
- --suffix '%d'
- install_external
- install_openstack
- else
- install_all
- fi
-
- $SUDO cp -r packstack/puppet/modules/packstack ${PUPPETFILE_DIR}
- }
- if [ $(id -u) != 0 ]; then
- SUDO='sudo -E'
-
- ssh-keygen -t rsa -C "packstack-integration-test" -N "" -f ~/.ssh/id_rsa
- $SUDO mkdir -p /root/.ssh
- cat ~/.ssh/id_rsa.pub | $SUDO tee -a /root/.ssh/authorized_keys
- $SUDO chmod 0600 /root/.ssh/authorized_keys
- $SUDO sed -i 's/^PermitRootLogin no/PermitRootLogin without-password/g' /etc/ssh/sshd_config
- $SUDO service sshd restart
- fi
- keystone_port=35357
- reserved_ports=$(sysctl net.ipv4.ip_local_reserved_ports | awk -F'=' '{print $2;}' | sed 's/^ //')
- if [[ -z "${reserved_ports}" ]]; then
- $SUDO sysctl -w net.ipv4.ip_local_reserved_ports=${keystone_port}
- else
- $SUDO sysctl -w net.ipv4.ip_local_reserved_ports=${keystone_port},${reserved_ports}
- fi
- source ./tools/fix_disk_layout.sh
- echo "${USER} soft nofile 65536" | $SUDO tee -a /etc/security/limits.conf
- echo "${USER} hard nofile 65536" | $SUDO tee -a /etc/security/limits.conf
- echo "root soft nofile 65536" | $SUDO tee -a /etc/security/limits.conf
- echo "root hard nofile 65536" | $SUDO tee -a /etc/security/limits.conf
- if [ "${MANAGE_REPOS}" = true ]; then
- $SUDO curl -L ${DELOREAN} -o /etc/yum.repos.d/delorean.repo
- $SUDO curl -L ${DELOREAN_DEPS} -o /etc/yum.repos.d/delorean-deps.repo
- $SUDO yum update -y
- fi
- $SUDO yum -y install puppet \
- yum-plugin-priorities \
- iproute \
- dstat \
- python-setuptools \
- openssl-devel \
- python-devel \
- libffi-devel \
- libxml2-devel \
- libxslt-devel \
- libyaml-devel \
- ruby-devel \
- openstack-selinux \
- policycoreutils \
- rubygems \
- wget \
- "@Development Tools"
- which pip || $SUDO easy_install pip
- rm -rf /tmp/cirros
- mkdir /tmp/cirros
- if [ -f ~/cache/files/cirros-0.3.4-x86_64-uec.tar.gz ]; then
- tar -xzvf ~/cache/files/cirros-0.3.4-x86_64-uec.tar.gz -C /tmp/cirros/
- else
- echo "No pre-cached uec archive found, downloading..."
- wget --tries=10 http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-uec.tar.gz -P /tmp/cirros/
- tar -xzvf /tmp/cirros/cirros-0.3.4-x86_64-uec.tar.gz -C /tmp/cirros/
- fi
- if [ -f ~/cache/files/cirros-0.3.4-x86_64-disk.img ]; then
- cp -p ~/cache/files/cirros-0.3.4-x86_64-disk.img /tmp/cirros/
- else
- echo "No pre-cached disk image found, downloading..."
- wget --tries=10 http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img -P /tmp/cirros/
- fi
- echo "Using pre-cached images:"
- find /tmp/cirros -type f -printf "%m %n %u %g %s %t" -exec md5sum \{\} \;
- $SUDO su -c 'cat > /etc/puppet/puppet.conf <<EOF
- [main]
- logdir = /var/log/puppet
- rundir = /var/run/puppet
- ssldir = $vardir/ssl
- hiera_config = /etc/puppet/hiera.yaml
- [agent]
- classfile = $vardir/classes.txt
- localconfig = $vardir/localconfig
- EOF'
- $SUDO su -c 'cat > /etc/puppet/hiera.yaml <<EOF
- ---
- :backends:
- - yaml
- :yaml:
- :datadir: /placeholder
- :hierarchy:
- - common
- - defaults
- - "%{clientcert}"
- - "%{environment}"
- - global
- EOF'
- if [ -d /home/jenkins/.puppet ]; then
- $SUDO rm -f /home/jenkins/.puppet
- fi
- $SUDO puppet config set hiera_config /etc/puppet/hiera.yaml
- if type "dstat" 2>/dev/null; then
- $SUDO dstat -tcmndrylpg \
- --top-cpu-adv \
- --top-io-adv \
- --nocolor | $SUDO tee -a /var/log/dstat.log > /dev/null &
- fi
- if [ "${INSTALL_FROM_SOURCE}" = true ]; then
- $SUDO pip install .
- export GEM_BIN_DIR=/tmp/packstackgems/bin/
- export PUPPETFILE_DIR=/usr/share/openstack-puppet/modules
- export GEM_HOME=/tmp/packstackgems
- $SUDO gem install r10k --no-ri --no-rdoc
-
- $SUDO rm -rf "${PUPPETFILE_DIR:?}/"*
- install_modules
- else
- $SUDO yum -y install openstack-packstack
- fi
- $SUDO rm -rf /etc/puppet/modules/*
- echo -e "\n127.0.0.1 $(facter fqdn)" | $SUDO tee -a /etc/hosts
- source ./tests/${SCENARIO}.sh
- result=$?
- if [ -d /var/lib/tempest ]; then
- pushd /var/lib/tempest
- $SUDO /usr/bin/testr last || true
- $SUDO bash -c "/usr/bin/testr last --subunit > /var/tmp/packstack/latest/testrepository.subunit" || true
- 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
|