Run the OSA bootstrap in the Zuul pre phase

We will now run the bootstrap-ansible and bootstrap-aio scripts in
the Zuul pre-run job phase. This has several benefits:

- Job stability will be higher. When we occasionally receive nodepool
  instances with unreliable networking, the job will often die off
  during the role clone due to git or pip internet resource
  unavailability. Jobs that fail during pre-run will be retried
  several times by Zuul using different nodes/clouds.

- Jobs which inherit the integrated role's job definition may add
  pre-run playbooks of their own, which allow child jobs to
  configure OSA parameters in /etc/openstack_deploy (such as custom
  user variables or conf.d definitions). Child job pre-run playbooks
  will run after the parent's, so the child job can configure itself
  with the benefit of an already bootstrapped OSA AIO configuration.

- The Zuul pre-run phase runs on a separate timeout from the run
  phase, so our run playbook will have more time available to it
  due to the bootstrapping being done before the run timeout begins.

Environment variables are used to skip the bootstrap scripts when
executing gate-check-commit during the job's run phase.

Change-Id: I0e77423a1f28d9a53215ae68c1f9f3e2af00f340
This commit is contained in:
Logan V 2019-05-10 23:56:12 -05:00
parent 4bc3e429c5
commit d8a03801c2
4 changed files with 52 additions and 7 deletions

View File

@ -47,14 +47,14 @@ export GROUP_VARS_PATH="/dev/null"
# Run AIO bootstrap playbook
pushd tests
if [ -z "${BOOTSTRAP_OPTS}" ]; then
ansible-playbook bootstrap-aio.yml
/usr/local/bin/ansible-playbook bootstrap-aio.yml
else
export BOOTSTRAP_OPTS_ITEMS=''
for BOOTSTRAP_OPT in ${BOOTSTRAP_OPTS}; do
BOOTSTRAP_OPTS_ITEMS=${BOOTSTRAP_OPTS_ITEMS}"-e "${BOOTSTRAP_OPT}" "
done
ansible-playbook bootstrap-aio.yml \
${BOOTSTRAP_OPTS_ITEMS}
/usr/local/bin/ansible-playbook bootstrap-aio.yml \
${BOOTSTRAP_OPTS_ITEMS}
fi
popd

View File

@ -24,6 +24,7 @@
- name: openstack/openstack-ansible
pre-run:
- zuul.d/playbooks/pre-gate-scenario.yml
- zuul.d/playbooks/pre-osa-aio.yml
run: zuul.d/playbooks/run.yml
post-run:
- zuul.d/playbooks/post.yml

View File

@ -0,0 +1,43 @@
---
# Copyright 2019, Logan Vig <logan2211@gmail.com>
#
# 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.
- name: Bootstrap the OSA AIO
hosts: all[0]
vars_files:
- "{{ zuul.executor.work_root }}/osa-gate-scenario.yml"
tasks:
- name: Run bootstrap-ansible script
become: yes
become_user: root
shell: scripts/bootstrap-ansible.sh
args:
chdir: "src/opendev.org/openstack/openstack-ansible"
executable: /bin/bash
environment:
# ZUUL_SRC_PATH is used by tests/get-ansible-role-requirements to
# where the CI provided git sources were cloned.
ZUUL_SRC_PATH: "{{ ansible_user_dir }}/src"
ANSIBLE_PACKAGE: "{{ ansible_package | default('') }}"
- name: Run bootstrap-aio script
become: yes
become_user: root
shell: scripts/bootstrap-aio.sh
args:
chdir: "src/opendev.org/openstack/openstack-ansible"
executable: /bin/bash
environment:
SCENARIO: "{{ scenario }}"
ACTION: "{{ action }}"
INSTALL_METHOD: "{{ install_method }}"

View File

@ -14,7 +14,8 @@
chdir: "src/opendev.org/openstack/openstack-ansible"
executable: /bin/bash
environment:
# ZUUL_SRC_PATH is used by tests/get-ansible-role-requirements to
# where the CI provided git sources were cloned.
ZUUL_SRC_PATH: "{{ ansible_user_dir }}/src"
ANSIBLE_PACKAGE: "{{ ansible_package | default('') }}"
# NOTE(logan): The project is bootstrapped in the pre playbook so the
# bootstrapping can be skipped here
SKIP_OSA_RUNTIME_VENV_BUILD: 1
SKIP_OSA_BOOTSTRAP_AIO: 1
SKIP_OSA_ROLE_CLONE: 1