Full quickstart gate run on OVB

Run quickstart experimental gate on OVB environment

Change-Id: I396f191c18c2b7e066dd9488765c3f66180d78f0
This commit is contained in:
Sagi Shnaidman 2016-10-03 15:44:11 +03:00
parent 2a047cd945
commit a99e2a523d
11 changed files with 533 additions and 0 deletions

View File

@ -319,3 +319,29 @@ function sanitize_ip_address {
echo $ip
fi
}
function get_image {
local img="$1"
http_proxy= wget -T 60 --tries=3 --progress=dot:mega http://$MIRRORSERVER/builds/current-tripleo/$img -O $img || {
wget -T 60 --tries=3 --progress=dot:mega http://66.187.229.139/builds/current-tripleo/$img -O $img
}
}
function prepare_images_oooq {
get_image ipa_images.tar
get_image overcloud-full.tar
tar -xvf overcloud-full.tar
tar -xvf ipa_images.tar
update_image $PWD/ironic-python-agent.initramfs
update_image $PWD/overcloud-full.qcow2
cp ironic-python-agent.* ~/
cp overcloud-full.qcow2 overcloud-full.initrd overcloud-full.vmlinuz ~/
rm -f overcloud-full.tar ipa_images.tar
}
function collect_oooq_logs {
sudo cp /var/log/quickstart_*.log $OOOQ_LOGS/ || true
tar -czf $OOOQ_LOGS/quickstart.tar.gz $OPT_WORKDIR
mkdir -p $OOOQ_LOGS/collected_logs
}

11
scripts/hosts Normal file
View File

@ -0,0 +1,11 @@
localhost ansible_connection=local
127.0.0.2 ansible_host=127.0.0.2 ansible_user=jenkins ansible_private_key_file=/home/jenkins/.ssh/id_rsa undercloud_ip=127.0.0.2
undercloud ansible_host=undercloud ansible_user=jenkins ansible_private_key_file=/home/jenkins/.ssh/id_rsa undercloud_ip=127.0.0.2
[virthost]
127.0.0.2
[undercloud]
undercloud

View File

@ -0,0 +1,16 @@
---
# TODO(sshnaidm): remove tripleo.sh and use ansible build image role
- name: Get images for quickstart
hosts: undercloud
gather_facts: no
tasks:
- name: Prepare images
shell: >
source {{tripleo_root}}/tripleo-ci/scripts/common_functions.sh;
prepare_images_oooq
when: "not '{{ lookup('env', 'STABLE_RELEASE') }}'"
- name: Prepare images for stable branch
shell: >
STABLE_RELEASE='{{ lookup('env', 'STABLE_RELEASE') }}' {{tripleo_root}}/tripleo-ci/scripts/tripleo.sh --overcloud-images 2>&1 | sudo dd of=/var/log/image_build.txt;
when: "'{{ lookup('env', 'STABLE_RELEASE') }}'"

View File

@ -0,0 +1,44 @@
# Install repo on live undercloud and overcloud image
- name: Clone the gated DLRN repos and trigger rpm injection
hosts: undercloud
vars:
artg_compressed_gating_repo: "/home/jenkins/gating_repo.tar.gz"
ansible_user: jenkins
ansible_user_dir: /home/jenkins/
tasks:
- stat: path="{{ artg_compressed_gating_repo }}"
register: gating_repo_file
- environment:
LIBGUESTFS_BACKEND: direct
LIBVIRT_DEFAULT_URI: 'qemu:///session'
block:
- name: Create the undercloud live injection script
template:
src: "{{ tripleo_root }}/tripleo-quickstart/roles/libvirt/setup/undercloud/templates/inject_gating_repo.sh.j2"
dest: "{{ working_dir }}/inject_gating_repo.sh"
- name: Copy repo file to /tmp/
command: cp -f "{{ artg_compressed_gating_repo }}" /tmp/gating_repo.tar.gz
- stat: path="{{ working_dir }}/overcloud-full.qcow2"
register: overcloud_full_img
- name: Install virt-customize if not installed
yum: name=libguestfs-tools-c state=latest
become: true
when: overcloud_full_img.stat.exists
- name: Inject the gating repo to overcloud image on live undercloud
command: >
virt-customize -a {{ working_dir }}/overcloud-full.qcow2
--upload /tmp/gating_repo.tar.gz:/tmp/gating_repo.tar.gz
--run '{{ working_dir }}/inject_gating_repo.sh'
when: overcloud_full_img.stat.exists
- name: Run gating repo on live undercloud
shell: >
bash {{ working_dir }}/inject_gating_repo.sh > {{ working_dir }}/inject_repo.log
become: true
when: "{{ lookup('env', 'USE_DELOREAN')|default(0, true) }} == 1 and gating_repo_file.stat.exists"

View File

@ -0,0 +1,107 @@
---
- name: Add the undercloud node to the generated inventory
hosts: localhost
gather_facts: yes
tags:
- undercloud-scripts
roles:
- tripleo-inventory
- include: tripleo-ci-setup-playbook.yml
# Deploy the undercloud
- name: Install undercloud
hosts: undercloud
gather_facts: no
roles:
- tripleo/undercloud
- include: post-undercloud-playbook.yml
tags:
- post-undercloud
- include: get_images-playbook.yml
tags:
- image-build
- name: copy over config files
hosts: undercloud
gather_facts: no
roles:
- overcloud-prep-config
- name: Perpare the baremetal overcloud
hosts: undercloud
gather_facts: no
roles:
- overcloud-prep-baremetal
# Prepare the overcloud images for deployment
- name: Prepare the overcloud images for deployment
hosts: undercloud
gather_facts: no
roles:
- overcloud-prep-images
- name: Remove big image
hosts: undercloud
gather_facts: no
tasks:
- name: Remove overcloud-full.qcow2
file: path=~/overcloud-full.qcow2 state=absent
# Prepare the undercloud networks for the overcloud deployment
- name: Prepare the undercloud networks for the overcloud deployment
hosts: undercloud
gather_facts: no
roles:
- overcloud-prep-network
# Deploy the overcloud
- name: Deploy the overcloud
hosts: undercloud
gather_facts: no
roles:
- tripleo-overcloud
- name: Add the overcloud nodes to the generated inventory
hosts: undercloud
gather_facts: yes
tags:
- overcloud-deploy
vars:
inventory: all
roles:
- tripleo-inventory
# Check the results of the deployment, note after inventory has executed
- name: Check the result of the deployment
hosts: localhost
tags:
- overcloud-deploy
tasks:
- name: ensure the deployment result has been read into memory
include_vars: "{{ local_working_dir }}/overcloud_deployment_result.json"
# overcloud_deploy_result = ["failed", "passed"]
- name: did the deployment pass or fail?
debug: var=overcloud_deploy_result
failed_when: overcloud_deploy_result == "failed"
# Validate the deployment
- name: validate the overcloud
hosts: undercloud
tags:
- overcloud-validate
gather_facts: no
roles:
- { role: tripleo-overcloud-validate, when: test_ping == true }
# Execute tempest against the overcloud deployment
- name: Execute tempest against the overcloud
hosts: undercloud
tags:
- overcloud-validate
gather_facts: no
roles:
- { role: tripleo-tempest, when: run_tempest == true }

View File

@ -0,0 +1,102 @@
run_tempest: false
step_adjust_mtu: true
mtu: 1350
mtu_interface:
- eth0
- eth1
- eth2
external_interface: eth2
external_interface_ip: 10.0.0.1
external_interface_netmask: 255.255.255.0
external_interface_hwaddr: fa:16:3e:79:e8:04
floating_ip_cidr: 10.0.0.0/24
public_net_pool_start: 10.0.0.50
public_net_pool_end: 10.0.0.100
public_net_gateway: 10.0.0.1
# Running quickstart with its own config
network_isolation_type: network-isolation
network_isolation: true
enable_pacemaker: true
deploy_timeout: 110
# Running quickstart as tripleo-ci exactly
step_introspect: "{{ lookup('env','INTROSPECT')|bool }}"
undercloud_generate_service_certificate: "{{ lookup('env','UNDERCLOUD_SSL')|bool }}"
#overcloud_nodes:
enable_pacemaker: "{{ lookup('env','PACEMAKER')|bool }}"
deploy_args: "{{ lookup('env','OVERCLOUD_DEPLOY_ARGS') }} --validation-errors-fatal --validation-warnings-fatal"
network_isolation: "{{ lookup('env','NETISO_V4')|bool }}"
# Collect logs settings
artcl_publish: false
artcl_rsync_logs: false
artcl_collect_list:
- /var/log/
- /var/lib/mysql
- /home/jenkins/.instack/install-undercloud.log
- /home/jenkins/stackrc
- /home/jenkins/overcloudrc
- /home/jenkins/*.log
- /home/jenkins/*.json
- /home/jenkins/*.conf
- /home/jenkins/*.yml
- /home/jenkins/*.yaml
- /home/jenkins/*.sh
- /home/jenkins/deploy-overcloudrc
- /home/jenkins/network-environment.yaml
- /home/jenkins/tempest/*.xml
- /home/jenkins/tempest/*.html
- /home/jenkins/tempest/*.log
- /home/jenkins/tempest/*.sh
- /home/jenkins/tempest/etc/*.conf
- /home/jenkins/local_tht
- /usr/share/openstack-tripleo-heat-templates
- /tmp/*.yml
- /tmp/*.yaml
- /etc/aodh
- /etc/ceilometer
- /etc/cinder
- /etc/dnsmasq-ironic.conf
- /etc/docker-registry.yml
- /etc/glance
- /etc/gnocchi
- /etc/heat
- /etc/haproxy
- /etc/httpd
- /etc/ironic
- /etc/ironic-inspector
- /etc/keepalived
- /etc/keystone
- /etc/libvirt
- /etc/manila
- /etc/mistral
- /etc/mongod.conf
- /etc/mongos.conf
- /etc/neutron
- /etc/nova
- /etc/ntp
- /etc/ntp.conf
- /etc/os-collect-config.conf
- /etc/os-net-config
- /etc/puppet
- /etc/qpid
- /etc/qpidd.conf
- /etc/rabbitmq
- /etc/redis
- /etc/redis.conf*
- /etc/resolv.conf
- /etc/sahara
- /etc/selinux
- /etc/swift
- /etc/sysconfig
- /etc/systemd
- /etc/trove
- /etc/yum.repos.d
- /etc/zaqar
artcl_gzip_only: true

View File

@ -0,0 +1,37 @@
# Post undercloud specific tasks
# TODO(sshnaidm): to include everything into one bash script(?)
- name: Post undercloud specific tasks
hosts: undercloud
gather_facts: no
tasks:
- name: Delete /tmp/eth2.cfg file
file: dest=/tmp/eth2.cfg state=absent
- name: Create /tmp/eth2.cfg file
blockinfile:
dest: /tmp/eth2.cfg
content: |
network_config:
- type: interface
name: eth2
use_dhcp: false
addresses:
- ip_netmask: 10.0.0.1/24
- ip_netmask: 2001:db8:fd00:1000::1/64
create: yes
- name: Add eth2 interface from /tmp/eth2.cfg
command: os-net-config -c /tmp/eth2.cfg -v
become: true
- name: Remove redundant hosts from instackenv.json
shell: >
cp ~/instackenv.json ~/instackenv.json.backup;
cat ~/instackenv.json | jq '{"nodes": .nodes[:{{ lookup('env', 'NODECOUNT') }}]}' > /tmp/instackenv1.json;
mv /tmp/instackenv1.json ~/instackenv.json;
- name: Install ipmitool if not installed
yum: name=ipmitool state=latest
become: true
- name: Set user permissions for ~/.cache for building images
shell: sudo chown -R $USER ~/.cache || true

View File

@ -0,0 +1,2 @@
ironic::drivers::deploy::http_port: 3816
ironic::drivers::ssh::libvirt_uri: 'qemu:///session'

View File

@ -0,0 +1,60 @@
---
# TODO(sshnaidm): to ansibilize this playbook
- name: Local setup for quickstart
hosts: localhost
connection: local
tasks:
- name: Host setup
shell: >
sudo hostnamectl set-hostname undercloud;
echo 'undercloud' | sudo dd of=/etc/hostname;
echo "127.0.0.1 $(hostname) $(hostname).openstacklocal" | sudo tee -a /etc/hosts;
echo "127.0.0.2 undercloud undercloud.openstacklocal" | sudo tee -a /etc/hosts;
if [ ! -e ${HOME}/.ssh/id_rsa.pub ] ; then
if [[ -e ${HOME}/.ssh/id_rsa ]]; then
ssh-keygen -y -f ${HOME}/.ssh/id_rsa > ${HOME}/.ssh/id_rsa.pub;
else
ssh-keygen -N "" -f ${HOME}/.ssh/id_rsa;
fi
fi;
cat ~/.ssh/id_rsa.pub | sudo tee -a /root/.ssh/authorized_keys | tee -a ~/.ssh/authorized_keys;
sudo yum remove -y puppet hiera puppetlabs-release rdo-release;
sudo rm -rf /etc/puppet /etc/hiera.yaml;
sudo cp {{tripleo_root}}/tripleo-ci/test-environments/overcloud-cacert.pem /etc/pki/ca-trust/source/anchors/;
sudo update-ca-trust extract;
cp -f {{ lookup('env', 'TE_DATAFILE') }} ~/instackenv.json;
{{tripleo_root}}/tripleo-ci/scripts/tripleo.sh --repo-setup;
sudo yum reinstall -y python-requests || sudo yum install -y python-requests;
sudo yum install -y python-tripleoclient libguestfs-xfs libguestfs-tools-c;
tags:
- local
# TODO(sshnaidm): to move this to settings(?)
- name: Prepare environment for quickstart
hosts: undercloud
gather_facts: no
tasks:
- name: Here comes any undercloud setup which is required for quickstart to run
debug: msg="Here comes any setup which is required for quickstart to run"
- name: Add hiera overriding file
template:
src: "{{tripleo_root}}/tripleo-ci/scripts/quickstart/quickstart-hieradata-overrides.yaml.j2"
dest: ~/quickstart-hieradata-overrides.yaml
# TODO(sshnaidm): fix role for proper handle of skipped projects
- name: Run DLRN gate role and create repo
hosts: undercloud
vars:
artg_compressed_gating_repo: "/home/jenkins/gating_repo.tar.gz"
ansible_user: jenkins
ansible_user_dir: /home/jenkins/
artg_skipped_projects:
- openstack/tripleo-quickstart
- openstack-infra/tripleo-ci
roles:
- { role: tripleo-gate, when: "{{ lookup('env', 'USE_DELOREAN')|default(0, true) }} == 1" }
# TODO(sshnaidm): to create a separate role for this in quickstart-extras(?)
- include: inject_repo-playbook.yml

View File

@ -83,6 +83,7 @@ export CONTROLLER_HOSTS=
export COMPUTE_HOSTS=
export SUBNODES_SSH_KEY=
export TEST_OVERCLOUD_DELETE=0
export OOOQ=0
if [[ $TOCI_JOBTYPE =~ scenario ]]; then
export PINGTEST_TEMPLATE=${PINGTEST_TEMPLATE:-"${TOCI_JOBTYPE}-pingtest"}
@ -209,6 +210,10 @@ for JOB_TYPE_PART in $(sed 's/-/ /g' <<< "${TOCI_JOBTYPE:-}") ; do
export RUN_TEMPEST_TESTS=1
export RUN_PING_TEST=0
;;
oooq)
export OOOQ=1
TOCIRUNNER="./toci_instack_oooq.sh"
;;
esac
done

123
toci_instack_oooq.sh Executable file
View File

@ -0,0 +1,123 @@
#!/usr/bin/env bash
set -eux
# TODO(sshnaidm): when transitioning to oooq, remove this file
# move only necessary to toci_gate_test.sh
## Signal to toci_gate_test.sh we've started by
touch /tmp/toci.started
exit_value=0
export CURRENT_DIR=$(dirname ${BASH_SOURCE[0]:-$0})
export TRIPLEO_CI_DIR=$CURRENT_DIR/../
# TODO(sshnaidm): remove this immediately when settings are in yaml files
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
export USE_DELOREAN=0
# TODO(sshnaidm): Hack for gate role, the excluded repos should be handled
# properly there. To fix ansible gate role.
export ZUUL_CHANGES=${ZUUL_CHANGES:-}
export ZUUL_CHANGES=$(echo $ZUUL_CHANGES | python -c 'import sys; print "^".join([i for i in sys.stdin.readline().split("^") if "openstack-infra/tripleo-ci:" not in i])')
if [[ -n "$ZUUL_CHANGES" ]]; then
export ZUUL_HOST="review.openstack.org"
export USE_DELOREAN=1
fi
# TODO(sshnaidm): To create tripleo-ci special yaml config files in oooq
# for every TOCI_JOBTYPE, i.e. ovb-nonha-ipv6.yml
if [[ "$TOCI_JOBTYPE" =~ "-ha" ]]; then
CONFIG=${CONFIG:-"$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/ha.yml"}
elif [[ "$TOCI_JOBTYPE" =~ "-nonha" ]]; then
CONFIG=${CONFIG:-"$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/minimal.yml"}
else
CONFIG=${CONFIG:-"$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/minimal.yml"}
fi
# TODO(sshnaidm): to move these variables to jobs yaml config files (see above)
if [[ "${STABLE_RELEASE}" =~ ^(liberty|mitaka)$ ]] ; then
export OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e $TRIPLEO_ROOT/tripleo-ci/test-environments/worker-config-mitaka-and-below.yaml"
else
export 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
export OPT_WORKDIR=${WORKSPACE}/.quickstart
export OOOQ_LOGS=/var/log/oooq
export OOO_WORKDIR_LOCAL=$HOME
export OOOQ_DEFAULT_ARGS=" --working-dir $OPT_WORKDIR --retain-inventory -T none -e working_dir=$OOO_WORKDIR_LOCAL -R ${STABLE_RELEASE:-master}"
export OOOQ_ARGS=" --config $CONFIG \
-e @$TRIPLEO_ROOT/tripleo-ci/scripts/quickstart/ovb-settings.yml -e tripleo_root=$TRIPLEO_ROOT \
-e undercloud_hieradata_override_file=~/quickstart-hieradata-overrides.yaml \
-e gating_repo_enabled=True"
export PLAYBOOK=" --playbook ovb-playbook.yml --requirements quickstart-extras-requirements.txt "
# Try to clean as much as possible
shopt -s extglob
rm -rf /opt/stack/new/!(tripleo-ci|tripleo-quickstart|tripleo-quickstart-extras)
# End of cleaning
# HINT: If there's no enough space, remove swap file in /root/
# TODO(sshnaidm): when collect-logs role will have the same functionality,
# replace postci function with this role (see in the end of file).
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 | ts '%Y-%m-%d %H:%M:%S.000 |' > $WORKSPACE/logs/postci.log 2>&1" EXIT
mkdir -p $WORKSPACE/logs
[[ ! -e $OPT_WORKDIR ]] && mkdir -p $OPT_WORKDIR && sudo chown -R ${USER} $OPT_WORKDIR
sudo mkdir $OOOQ_LOGS && sudo chown -R ${USER} $OOOQ_LOGS
# TODO(sshnaidm): check why it's not cloned
[[ ! -e $TRIPLEO_ROOT/tripleo-quickstart ]] && /usr/zuul-env/bin/zuul-cloner --workspace /opt/stack/new/ https://git.openstack.org/openstack tripleo-quickstart
cp $TRIPLEO_ROOT/tripleo-ci/scripts/hosts $OPT_WORKDIR/hosts
cp $TRIPLEO_ROOT/tripleo-ci/scripts/quickstart/*yml $TRIPLEO_ROOT/tripleo-quickstart/playbooks/
$TRIPLEO_ROOT/tripleo-quickstart/quickstart.sh --install-deps
pushd $TRIPLEO_ROOT/tripleo-quickstart/
# TODO(sshnaidm): fix inventory role with prepares ssh.config.ansible,
# it's not usable here right now. Hopefully ssh config is not required for us.
export ANSIBLE_SSH_ARGS=""
$TRIPLEO_ROOT/tripleo-quickstart/quickstart.sh --bootstrap --no-clone \
-t all \
$PLAYBOOK $OOOQ_ARGS \
$OOOQ_DEFAULT_ARGS undercloud 2>&1 \
| ts '%Y-%m-%d %H:%M:%S.000 |' | sudo tee /var/log/quickstart_install.log || exit_value=2
# TODO(sshnaidm): to include this in general ovb-playbook(?)
if [[ -e ${OOO_WORKDIR_LOCAL}/overcloudrc ]]; then
$TRIPLEO_ROOT/tripleo-quickstart/quickstart.sh --bootstrap \
$OOOQ_DEFAULT_ARGS \
-t all \
--playbook tempest.yml \
--extra-vars run_tempest=True \
-e test_regex='.*smoke' undercloud 2>&1| sudo tee /var/log/quickstart_tempest.log || exit_value=$?
else
exit_value=1
fi
# TODO(sshnaidm): to prepare collect-logs role for tripleo-ci specific paths
# and remove this function then
collect_oooq_logs
# TODO(sshnaidm): hack for collect-logs role,
# fix it there by replacing hardcoded 'stack' user
sed -i "s@/home/stack/@/home/jenkins/@g" $OPT_WORKDIR/usr/local/share/ansible/roles/tripleo-collect-logs/tasks/create-docs.yml ||:
# TODO(sshnaidm): fix this either in role or quickstart.sh
# it will not duplicate logs from undercloud and 127.0.0.2
sed -i 's/hosts: all:!localhost/hosts: all:!localhost:!127.0.0.2/' $OPT_WORKDIR/playbooks/collect-logs.yml ||:
# TODO(sshnaidm): to move postci functionality into collect-logs role
$TRIPLEO_ROOT/tripleo-quickstart/quickstart.sh --bootstrap --no-clone \
$OOOQ_DEFAULT_ARGS \
--requirements quickstart-extras-requirements.txt \
--config $CONFIG \
--playbook collect-logs.yml \
-e artcl_collect_dir=/var/log/oooq/collected_logs \
-e @$TRIPLEO_ROOT/tripleo-ci/scripts/quickstart/ovb-settings.yml \
-e tripleo_root=$TRIPLEO_ROOT \
undercloud 2>&1| sudo tee /var/log/quickstart_collectlogs.log ||:
popd
echo 'Run completed.'
# TODO(sshnaidm): remove this when we're sure there's enough space
# Watch free space, the outage could break jobs
sudo df -h
exit $exit_value