From ac930796d66e7fdd952477df03d75c4024c8f5a2 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Mon, 16 Oct 2017 21:42:24 +0100 Subject: [PATCH] Initial OSA zuul v3 role jobs This patch implements an initial set of jobs intended to match the current job execution method. It does not intend to improve how the jobs are executed - only to replicate what is currently in openstack-infra/openstack-zuul-jobs and provide the platform to iterate on. Change-Id: Iafe9f3622037d7ba71f9ba8b73217f9e2070f246 --- get-ansible-role-requirements.yml | 6 ++- run_tests.sh | 20 ++------- test-ansible-env-prep.sh | 2 +- tests/tests-repo-clone.sh | 11 +++++ zuul.d/jobs.yaml | 74 +++++++++++++++++++++++++++++++ zuul.d/playbooks/run.yml | 23 ++++++++++ zuul.d/project.yaml | 28 ++++++++++++ 7 files changed, 145 insertions(+), 19 deletions(-) create mode 100644 zuul.d/jobs.yaml create mode 100644 zuul.d/playbooks/run.yml create mode 100644 zuul.d/project.yaml diff --git a/get-ansible-role-requirements.yml b/get-ansible-role-requirements.yml index 1f3d38c9..3a4ed078 100644 --- a/get-ansible-role-requirements.yml +++ b/get-ansible-role-requirements.yml @@ -186,8 +186,10 @@ git_roles: > {%- set filtered_role_list = [] %} {%- for role in osa_roles %} - {%- if role['src'] | regex_replace('https://git.openstack.org/', '') not in zuul_src_repo_list %} - {%- set _ = filtered_role_list.append(role) %} + {%- if (role['name'] | match('os_previous_.*')) or + (role['name'] | match('previous_.*')) or + (role['src'] | regex_replace('https://git.openstack.org/', '') not in zuul_src_repo_list) %} + {%- set _ = filtered_role_list.append(role) %} {%- endif %} {%- endfor %} {{- filtered_role_list -}} diff --git a/run_tests.sh b/run_tests.sh index e8f6f3ac..d9dacfb8 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -49,24 +49,12 @@ install_pkg_deps() { eval sudo $pkg_mgr_cmd $pkg_deps } -git_clone_repo() { - if [[ ! -d tests/common ]]; then - # The tests repo doesn't need a clone, we can just - # symlink it. - if [[ "$(basename ${WORKING_DIR})" == "openstack-ansible-tests" ]]; then - ln -s ${WORKING_DIR} ${WORKING_DIR}/tests/common - else - git clone \ - https://git.openstack.org/openstack/openstack-ansible-tests \ - tests/common - fi - fi -} - +# Install the host distro package dependencies install_pkg_deps -git_clone_repo +# Clone the tests repo for access to the common test script +source tests/tests-repo-clone.sh -# start executing the main test script +# Execute the common test script source tests/common/run_tests_common.sh diff --git a/test-ansible-env-prep.sh b/test-ansible-env-prep.sh index 36ddf7b2..9105be34 100755 --- a/test-ansible-env-prep.sh +++ b/test-ansible-env-prep.sh @@ -156,7 +156,7 @@ if [ ! -d "${ANSIBLE_ROLE_DIR}" ] && [ -f "${ANSIBLE_ROLE_REQUIREMENTS_PATH}" ]; ansible-playbook -i ${ANSIBLE_INVENTORY} \ ${COMMON_TESTS_PATH}/get-ansible-role-requirements.yml \ -e "toxinidir=${WORKING_DIR} homedir=${TESTING_HOME}" \ - -vvv + -v fi diff --git a/tests/tests-repo-clone.sh b/tests/tests-repo-clone.sh index 5dbdba02..3e4ffd66 100755 --- a/tests/tests-repo-clone.sh +++ b/tests/tests-repo-clone.sh @@ -33,6 +33,7 @@ set -e export TESTING_HOME=${TESTING_HOME:-$HOME} export WORKING_DIR=${WORKING_DIR:-$(pwd)} export CLONE_UPGRADE_TESTS=${CLONE_UPGRADE_TESTS:-no} +export ZUUL_TESTS_CLONE_LOCATION="/home/zuul/src/git.openstack.org/openstack/openstack-ansible-tests" ## Functions ----------------------------------------------------------------- @@ -84,6 +85,16 @@ elif [[ ! -d tests/common ]]; then if [[ "${ZUUL_SHORT_PROJECT_NAME:-none}" == "openstack-ansible-tests" ]] ||\ [[ "$(basename ${WORKING_DIR})" == "openstack-ansible-tests" ]]; then ln -s ${WORKING_DIR} ${WORKING_DIR}/tests/common + + # In zuul v3 any dependent repository is placed into + # /home/zuul/src/git.openstack.org, so we check to see + # if there is a tests checkout there already. If so, we + # symlink that and use it. + elif [[ -d "${ZUUL_TESTS_CLONE_LOCATION}" ]]; then + ln -s "${ZUUL_TESTS_CLONE_LOCATION}" ${WORKING_DIR}/tests/common + + # Otherwise we're clearly not in zuul or using a previously setup + # repo in some way, so just clone it from upstream. else git clone \ https://git.openstack.org/openstack/openstack-ansible-tests \ diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml new file mode 100644 index 00000000..3c9d38fd --- /dev/null +++ b/zuul.d/jobs.yaml @@ -0,0 +1,74 @@ +--- +# Copyright 2017, Rackspace US, Inc. +# +# 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. + +- job: + name: openstack-ansible-functional + parent: base + description: | + Run functional tests for an OpenStack-Ansible project. + Uses tox with the ``functional`` environment by default, + but the environment name can be changed through the use + of the ``scenario`` variable. + required-projects: + - name: openstack/requirements + irrelevant-files: + - ^\.git.* + - ^.*\.(example|md|rst)$ + - ^deploy-guide/.* + - ^doc/.* + - ^releasenotes/.* + - ^setup\.(cfg|py)$ + - ^tox.ini$ + - ^Vagrantfile + timeout: 5400 # 90 mins + run: zuul.d/playbooks/run + vars: + tox_env: functional + +- job: + name: openstack-ansible-upgrade + parent: openstack-ansible-functional + vars: + tox_env: upgrade + +- job: + name: openstack-ansible-functional-ubuntu-xenial + parent: openstack-ansible-functional + nodeset: ubuntu-xenial + +- job: + name: openstack-ansible-upgrade-ubuntu-xenial + parent: openstack-ansible-upgrade + nodeset: ubuntu-xenial + +- job: + name: openstack-ansible-functional-opensuse-423 + parent: openstack-ansible-functional + nodeset: opensuse-423 + +- job: + name: openstack-ansible-functional-opensuse-423-nv + parent: openstack-ansible-functional-opensuse-423 + voting: false + +- job: + name: openstack-ansible-functional-centos-7 + parent: openstack-ansible-functional + nodeset: centos-7 + +- job: + name: openstack-ansible-functional-centos-7-nv + parent: openstack-ansible-functional-centos-7 + voting: false diff --git a/zuul.d/playbooks/run.yml b/zuul.d/playbooks/run.yml new file mode 100644 index 00000000..ec3ea448 --- /dev/null +++ b/zuul.d/playbooks/run.yml @@ -0,0 +1,23 @@ +--- +# Copyright 2017, Rackspace US, Inc. +# +# 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. + +- hosts: all + tasks: + - name: Run testing script + shell: | + ./run_tests.sh {{ tox_env }} + args: + executable: "/bin/bash" + chdir: "{{ ansible_user_dir }}/src/{{ zuul.project.canonical_name }}" diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml new file mode 100644 index 00000000..f01b7799 --- /dev/null +++ b/zuul.d/project.yaml @@ -0,0 +1,28 @@ +--- +# Copyright 2017, Rackspace US, Inc. +# +# 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. + +- project: + name: openstack/openstack-ansible-tests + check: + jobs: + - openstack-ansible-functional-centos-7 + - openstack-ansible-functional-opensuse-423 + - openstack-ansible-functional-ubuntu-xenial + gate: + queue: openstack-ansible + jobs: + - openstack-ansible-functional-centos-7 + - openstack-ansible-functional-opensuse-423 + - openstack-ansible-functional-ubuntu-xenial