Import beaker jobs into p-o-i

Import legacy jobs from openstack-zuul-jobs into p-o-i.

Change-Id: I8f4b24cfd5fa6d91758f95228f823d82839c3366
(cherry picked from commit c82fae7eed)
This commit is contained in:
Emilien Macchi 2017-12-21 11:18:54 -08:00
parent c7cb15b7a1
commit f0e0c23315
3 changed files with 133 additions and 0 deletions

View File

@ -360,6 +360,7 @@
- ^metadata.json$
- ^releasenotes/.*$
- ^test-requirements.txt$
- ^spec/acceptance/.*$
- job:
name: puppet-openstack-unit-3.6-centos-7
@ -425,3 +426,41 @@
templates:
- puppet-openstack-check-jobs
- puppet-openstack-integration-jobs-all
- job:
name: puppet-openstack-beaker-run-base
parent: puppet-openstack-integration-base
pre-run: playbooks/prepare-node-beaker.yaml
post-run: playbooks/upload-logs.yaml
run: playbooks/run-beaker-tests.yaml
timeout: 5400
irrelevant-files:
- ^.*\.md$
- ^spec/unit/.*$
- ^spec/classes/.*$
- ^test-requirements.txt$
- job:
name: puppet-openstack-beaker-centos-7
parent: puppet-openstack-beaker-run-base
nodeset: centos-7
vars:
nodepool_type: centos7
- job:
name: puppet-openstack-beaker-xenial
parent: puppet-openstack-beaker-run-base
nodeset: ubuntu-xenial
vars:
nodepool_type: xenial
- project-template:
name: puppet-openstack-beaker-jobs
check:
jobs:
- puppet-openstack-beaker-centos-7
- puppet-openstack-beaker-xenial
gate:
jobs:
- puppet-openstack-beaker-centos-7
- puppet-openstack-beaker-xenial

View File

@ -0,0 +1,35 @@
- hosts: all
tasks:
- shell:
cmd: |
set -e
set -x
CLONEMAP=`mktemp`
function cleanup {
# In cases where zuul-cloner is aborted during a git
# clone operation, git will remove the git work tree in
# its cleanup. The work tree in these jobs is the
# workspace directory, which means that subsequent
# jenkins post-build actions can not run because the
# workspace has been removed.
# To reduce the likelihood of this having an impact,
# recreate the workspace directory if needed
mkdir -p $WORKSPACE
rm -f $CLONEMAP
}
trap cleanup EXIT
cat > $CLONEMAP << EOF
clonemap:
- name: $ZUUL_PROJECT
dest: .
- name: openstack/puppet-openstack-integration
dest: openstack/puppet-openstack-integration
EOF
/usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \
git://git.openstack.org $ZUUL_PROJECT openstack/puppet-openstack-integration
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace'
environment: '{{ zuul | zuul_legacy_vars }}'
- include_role:
name: bindep

View File

@ -0,0 +1,59 @@
- 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 ]; 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/openstack/puppet-openstack-integration/copy_logs.sh" EXIT
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
gem install bundler --no-rdoc --no-ri --verbose
$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 }}'