From d8a03801c293df2a79164c5460d75752cf1e420e Mon Sep 17 00:00:00 2001 From: Logan V Date: Fri, 10 May 2019 23:56:12 -0500 Subject: [PATCH] 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 --- scripts/bootstrap-aio.sh | 6 ++--- zuul.d/jobs.yaml | 1 + zuul.d/playbooks/pre-osa-aio.yml | 43 ++++++++++++++++++++++++++++++++ zuul.d/playbooks/run.yml | 9 ++++--- 4 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 zuul.d/playbooks/pre-osa-aio.yml diff --git a/scripts/bootstrap-aio.sh b/scripts/bootstrap-aio.sh index f8bd73cc7f..1fb1aea315 100755 --- a/scripts/bootstrap-aio.sh +++ b/scripts/bootstrap-aio.sh @@ -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 diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 8641b3cbc0..ce15fbee06 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -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 diff --git a/zuul.d/playbooks/pre-osa-aio.yml b/zuul.d/playbooks/pre-osa-aio.yml new file mode 100644 index 0000000000..cd1bd07efe --- /dev/null +++ b/zuul.d/playbooks/pre-osa-aio.yml @@ -0,0 +1,43 @@ +--- +# Copyright 2019, Logan Vig +# +# 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 }}" diff --git a/zuul.d/playbooks/run.yml b/zuul.d/playbooks/run.yml index 918624f470..5c184bf977 100644 --- a/zuul.d/playbooks/run.yml +++ b/zuul.d/playbooks/run.yml @@ -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