puppet-openstack-integration/playbooks/run-beaker-tests.yaml
Emilien Macchi cba426abf7 beaker jobs: fix path for copy_logs.sh
It wasn't updated when zuul-cloner was removed.

Change-Id: I1127679bb2cb2bc4023598536924f38f0e206b1e
2019-07-30 19:48:02 +00:00

70 lines
2.9 KiB
YAML

- hosts: all
tasks:
- name: Prepare ssh config on the host to run beaker
shell:
cmd: |
echo "" | sudo tee -a /etc/ssh/sshd_config
echo "Match address 127.0.0.1" | sudo tee -a /etc/ssh/sshd_config
echo " PermitRootLogin without-password" | sudo tee -a /etc/ssh/sshd_config
echo "" | sudo tee -a /etc/ssh/sshd_config
echo "Match address ::1" | sudo tee -a /etc/ssh/sshd_config
echo " PermitRootLogin without-password" | sudo tee -a /etc/ssh/sshd_config
mkdir -p .ssh
ssh-keygen -f ~/.ssh/id_rsa -b 2048 -P ""
sudo mkdir -p /root/.ssh
cat ~/.ssh/id_rsa.pub | sudo tee -a /root/.ssh/authorized_keys
if [[ -f /usr/bin/yum || -f /usr/bin/dnf ]]; then
sudo systemctl reload sshd
elif [ -f /usr/bin/apt-get ]; then
sudo service ssh restart
fi
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace'
environment: '{{ zuul | zuul_legacy_vars }}'
- name: Run beaker
shell:
cmd: |
trap "{{ ansible_user_dir }}/workspace/puppet-openstack-integration/copy_logs.sh" EXIT
if [ "{{ puppet_gem_version }}" != "latest" ]; then
export PUPPET_GEM_VERSION='~> {{ puppet_gem_version }}'
fi
export BEAKER_PUPPET_COLLECTION=puppet5
export BEAKER_set=nodepool-{{ nodepool_type }}
export BEAKER_debug=yes
export BEAKER_color=no
if [ -f Modulefile -o -f metadata.json ]; then
if [ -f Modulefile ]; then
MODULE=$(awk '/^name/ {print $NF}' Modulefile |tr -d \"\')
elif [ -f metadata.json ]; then
MODULE=$(python -c 'import json;print json.load(open("metadata.json"))["name"]')
fi
if [ -z "$MODULE" ]; then
echo "Module name not defined in Modulefile or metadata.json"
else
mkdir -p "$MODULE"
rsync -a --exclude="$MODULE" --exclude ".*" . "$MODULE"
cd "$MODULE"
fi
fi
mkdir .bundled_gems
export GEM_HOME=`pwd`/.bundled_gems
if [ -f Gemfile ]; then
ruby <<EOF
cmd = 'gem install bundler --no-rdoc --no-ri --verbose'
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0') then
cmd += ' -v 1.17.3'
end
system(cmd)
EOF
$GEM_HOME/bin/bundle install --without system_tests --retry 3
$GEM_HOME/bin/bundle exec rspec spec/acceptance
else
gem install rake -n ./.bundled_gems/
gem install beaker-rspec
gem install puppetlabs_spec_helper
./.bundled_gems/rake acceptance 2>&1
fi
chdir: '{{ ansible_user_dir }}/workspace'
executable: /bin/bash
environment: '{{ zuul | zuul_legacy_vars }}'