From bab647771b2b4e37f76309ae017ed279ec7af1b7 Mon Sep 17 00:00:00 2001 From: Iury Gregory Melo Ferreira Date: Thu, 24 Jan 2019 16:00:21 +0100 Subject: [PATCH] Move to zuulv3 To move ironicclient legacy jobs to zuulv3 the the following changes were necessary: - Change `tox.ini` to pass envrioment variables - Clean `post_test_hook.sh` to avoid legacy variables (`$USER` and `$BASE`), removing `generate_testr_results` function since we only get `testrepository.subunit` in logs and the results of the tests are present in job-output file. - Convert `post_test_hook.sh` and `run_functional.sh` into `playbooks/functional/run.yaml` to run after the setup. Also includes the changes from commit 9cd6ce7eb2d96a8f58a4d00f85b405babf67d28f Change-Id: I6a5b3f82c238083b66bdf6f379092260d367d82d (cherry picked from commit 2c349cc8930897052e66d29a70e1e7f1c4d40d79) --- .../tests/functional/hooks/post_test_hook.sh | 49 -------- playbooks/functional/run.yaml | 49 ++++++++ .../ironicclient-dsvm-functional/post.yaml | 15 --- .../ironicclient-dsvm-functional/run.yaml | 68 ----------- .../ironicclient-tempest-dsvm-src/post.yaml | 15 --- .../ironicclient-tempest-dsvm-src/run.yaml | 113 ------------------ tools/run_functional.sh | 28 ----- tox.ini | 1 + zuul.d/ironicclient-jobs.yaml | 48 ++++++++ zuul.d/legacy-ironicclient-jobs.yaml | 42 ------- zuul.d/project.yaml | 8 +- 11 files changed, 102 insertions(+), 334 deletions(-) delete mode 100755 ironicclient/tests/functional/hooks/post_test_hook.sh create mode 100644 playbooks/functional/run.yaml delete mode 100644 playbooks/legacy/ironicclient-dsvm-functional/post.yaml delete mode 100644 playbooks/legacy/ironicclient-dsvm-functional/run.yaml delete mode 100644 playbooks/legacy/ironicclient-tempest-dsvm-src/post.yaml delete mode 100644 playbooks/legacy/ironicclient-tempest-dsvm-src/run.yaml delete mode 100755 tools/run_functional.sh create mode 100644 zuul.d/ironicclient-jobs.yaml delete mode 100644 zuul.d/legacy-ironicclient-jobs.yaml diff --git a/ironicclient/tests/functional/hooks/post_test_hook.sh b/ironicclient/tests/functional/hooks/post_test_hook.sh deleted file mode 100755 index 77e4182e7..000000000 --- a/ironicclient/tests/functional/hooks/post_test_hook.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -xe - -# 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. - -# This script is executed inside post_test_hook function in devstack gate. - -function generate_testr_results { - if [ -f .testrepository/0 ]; then - sudo .tox/functional/bin/testr last --subunit > $WORKSPACE/testrepository.subunit - sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit - sudo /usr/os-testr-env/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html - sudo gzip -9 $BASE/logs/testrepository.subunit - sudo gzip -9 $BASE/logs/testr_results.html - sudo chown $USER:$USER $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz - sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz - fi -} - -export IRONICCLIENT_DIR="$BASE/new/python-ironicclient" - -sudo chown -R $USER:stack $IRONICCLIENT_DIR - -cd $IRONICCLIENT_DIR - -# Run tests -echo "Running ironicclient functional test suite" -set +e - -# Only admin credentials needed for ironic api -source $BASE/new/devstack/openrc admin admin - -# Preserve env for OS_ credentials -sudo -E -H -u $USER ./tools/run_functional.sh -EXIT_CODE=$? -set -e - -# Collect and parse result -generate_testr_results -exit $EXIT_CODE diff --git a/playbooks/functional/run.yaml b/playbooks/functional/run.yaml new file mode 100644 index 000000000..baa830aa7 --- /dev/null +++ b/playbooks/functional/run.yaml @@ -0,0 +1,49 @@ +- hosts: all + tasks: + - shell: + cmd: | + set -e + set -x + export BASE='/opt/stack' + export IRONICCLIENT_DIR="$BASE/python-ironicclient" + sudo chmod -R a+rw /opt/stack/ + cd $IRONICCLIENT_DIR + set +e + echo "Running ironicclient functional test suite" + + # Only admin credentials needed for ironic api + source $BASE/devstack/openrc admin admin + + FUNC_TEST_DIR=$IRONICCLIENT_DIR/ironicclient/tests/functional + CONFIG_FILE=$IRONICCLIENT_DIR/test.conf + echo 'Generating configuration file for functional tests' + + if [[ -n "$IRONIC_URL" ]]; then + cat <$CONFIG_FILE + [functional] + api_version = 1 + auth_strategy=noauth + ironic_url=$IRONIC_URL + END + else + cat <$CONFIG_FILE + [functional] + api_version = 1 + os_auth_url=$OS_AUTH_URL + os_identity_api_version=$OS_IDENTITY_API_VERSION + os_username=$OS_USERNAME + os_password=$OS_PASSWORD + os_project_name=$OS_PROJECT_NAME + os_user_domain_id=$OS_USER_DOMAIN_ID + os_project_domain_id=$OS_PROJECT_DOMAIN_ID + os_service_type=baremetal + os_endpoint_type=public + END + fi + echo 'Configuration file is in '$CONFIG_FILE'' + export IRONICCLIENT_TEST_CONFIG=$CONFIG_FILE + + cd $IRONICCLIENT_DIR + tox -e functional + executable: /bin/bash + chdir: '/opt/stack/python-ironicclient' diff --git a/playbooks/legacy/ironicclient-dsvm-functional/post.yaml b/playbooks/legacy/ironicclient-dsvm-functional/post.yaml deleted file mode 100644 index e07f5510a..000000000 --- a/playbooks/legacy/ironicclient-dsvm-functional/post.yaml +++ /dev/null @@ -1,15 +0,0 @@ -- hosts: primary - tasks: - - - name: Copy files from {{ ansible_user_dir }}/workspace/ on node - synchronize: - src: '{{ ansible_user_dir }}/workspace/' - dest: '{{ zuul.executor.log_root }}' - mode: pull - copy_links: true - verify_host: true - rsync_opts: - - --include=/logs/** - - --include=*/ - - --exclude=* - - --prune-empty-dirs diff --git a/playbooks/legacy/ironicclient-dsvm-functional/run.yaml b/playbooks/legacy/ironicclient-dsvm-functional/run.yaml deleted file mode 100644 index 101730b9d..000000000 --- a/playbooks/legacy/ironicclient-dsvm-functional/run.yaml +++ /dev/null @@ -1,68 +0,0 @@ -- hosts: all - name: Autoconverted job legacy-ironicclient-dsvm-functional from old job gate-ironicclient-dsvm-functional-ubuntu-xenial - tasks: - - - name: Ensure legacy workspace directory - file: - path: '{{ ansible_user_dir }}/workspace' - state: directory - - - shell: - cmd: | - set -e - set -x - cat > clonemap.yaml << EOF - clonemap: - - name: openstack-infra/devstack-gate - dest: devstack-gate - EOF - /usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \ - https://git.openstack.org \ - openstack-infra/devstack-gate - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: | - set -e - set -x - cat << 'EOF' >>"/tmp/dg-local.conf" - [[local|localrc]] - enable_plugin ironic https://git.openstack.org/openstack/ironic - IRONIC_DEPLOY_DRIVER=fake - # neutron is not enabled here - IRONIC_ENABLED_NETWORK_INTERFACES=noop - IRONIC_DHCP_PROVIDER=none - - EOF - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: | - set -e - set -x - export PYTHONUNBUFFERED=true - export DEVSTACK_GATE_TEMPEST=0 - export DEVSTACK_PROJECT_FROM_GIT=python-ironicclient - export OVERRIDE_ENABLED_SERVICES=key,mysql,rabbit,ir-api,ir-cond - export BRANCH_OVERRIDE=default - if [ "$BRANCH_OVERRIDE" != "default" ] ; then - export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE - fi - export PROJECTS="openstack/ironic $PROJECTS" - - function post_test_hook { - # Configure and run functional tests - $BASE/new/python-ironicclient/ironicclient/tests/functional/hooks/post_test_hook.sh - } - - export -f post_test_hook - - cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh - ./safe-devstack-vm-gate-wrap.sh - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' diff --git a/playbooks/legacy/ironicclient-tempest-dsvm-src/post.yaml b/playbooks/legacy/ironicclient-tempest-dsvm-src/post.yaml deleted file mode 100644 index e07f5510a..000000000 --- a/playbooks/legacy/ironicclient-tempest-dsvm-src/post.yaml +++ /dev/null @@ -1,15 +0,0 @@ -- hosts: primary - tasks: - - - name: Copy files from {{ ansible_user_dir }}/workspace/ on node - synchronize: - src: '{{ ansible_user_dir }}/workspace/' - dest: '{{ zuul.executor.log_root }}' - mode: pull - copy_links: true - verify_host: true - rsync_opts: - - --include=/logs/** - - --include=*/ - - --exclude=* - - --prune-empty-dirs diff --git a/playbooks/legacy/ironicclient-tempest-dsvm-src/run.yaml b/playbooks/legacy/ironicclient-tempest-dsvm-src/run.yaml deleted file mode 100644 index 04e8295a2..000000000 --- a/playbooks/legacy/ironicclient-tempest-dsvm-src/run.yaml +++ /dev/null @@ -1,113 +0,0 @@ -- hosts: all - name: Autoconverted job legacy-tempest-dsvm-python-ironicclient-src from old job - gate-tempest-dsvm-python-ironicclient-src-ubuntu-xenial - tasks: - - - name: Ensure legacy workspace directory - file: - path: '{{ ansible_user_dir }}/workspace' - state: directory - - - shell: - cmd: | - set -e - set -x - cat > clonemap.yaml << EOF - clonemap: - - name: openstack-infra/devstack-gate - dest: devstack-gate - EOF - /usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \ - https://git.openstack.org \ - openstack-infra/devstack-gate - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: | - cat << 'EOF' >> ironic-extra-vars - export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_VM_SPECS_RAM=384" - export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_RAMDISK_TYPE=tinyipa" - EOF - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: | - cat << 'EOF' >> ironic-extra-vars - export DEVSTACK_GATE_TEMPEST_REGEX="ironic_tempest_plugin.tests.scenario" - - EOF - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: | - cat << 'EOF' >> ironic-extra-vars - export DEVSTACK_PROJECT_FROM_GIT="python-ironicclient,$DEVSTACK_PROJECT_FROM_GIT" - - EOF - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: | - cat << 'EOF' >> ironic-vars-early - # use tempest plugin - export DEVSTACK_LOCAL_CONFIG+=$'\n'"TEMPEST_PLUGINS+=' /opt/stack/new/ironic-tempest-plugin'" - export TEMPEST_CONCURRENCY=1 - EOF - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: | - set -e - set -x - export PROJECTS="openstack/ironic $PROJECTS" - export PROJECTS="openstack/ironic-lib $PROJECTS" - export PROJECTS="openstack/ironic-python-agent $PROJECTS" - export PROJECTS="openstack/ironic-tempest-plugin $PROJECTS" - export PROJECTS="openstack/python-ironicclient $PROJECTS" - export PROJECTS="openstack/pyghmi $PROJECTS" - export PROJECTS="openstack/virtualbmc $PROJECTS" - export PYTHONUNBUFFERED=true - export DEVSTACK_GATE_TEMPEST=1 - export DEVSTACK_GATE_IRONIC=1 - export DEVSTACK_GATE_NEUTRON=1 - export DEVSTACK_GATE_VIRT_DRIVER=ironic - export DEVSTACK_GATE_CONFIGDRIVE=1 - export DEVSTACK_GATE_IRONIC_DRIVER=ipmi - export BRANCH_OVERRIDE=default - if [ "$BRANCH_OVERRIDE" != "default" ] ; then - export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE - fi - - if [[ ! "stable/newton stable/ocata stable/pike" =~ $ZUUL_BRANCH ]] ; then - export DEVSTACK_GATE_TLSPROXY=1 - fi - - export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_TEMPEST_WHOLE_DISK_IMAGE=False" - export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_VM_EPHEMERAL_DISK=1" - export DEVSTACK_GATE_IRONIC_BUILD_RAMDISK=0 - export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_INSPECTOR_BUILD_RAMDISK=False" - export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_VM_COUNT=1" - - # Ensure the ironic-vars-EARLY file exists - touch ironic-vars-early - # Pull in the EARLY variables injected by the optional builders - source ironic-vars-early - - export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin ironic https://git.openstack.org/openstack/ironic" - - # Ensure the ironic-EXTRA-vars file exists - touch ironic-extra-vars - # Pull in the EXTRA variables injected by the optional builders - source ironic-extra-vars - - cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh - ./safe-devstack-vm-gate-wrap.sh - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' diff --git a/tools/run_functional.sh b/tools/run_functional.sh deleted file mode 100755 index cf89a828c..000000000 --- a/tools/run_functional.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -FUNC_TEST_DIR=$(dirname $0)/../ironicclient/tests/functional/ -CONFIG_FILE=$FUNC_TEST_DIR/test.conf - -if [[ -n "$IRONIC_URL" ]]; then -cat <$CONFIG_FILE -[functional] -api_version = 1 -auth_strategy=noauth -ironic_url=$IRONIC_URL -END -else -cat <$CONFIG_FILE -[functional] -api_version = 1 -os_auth_url=$OS_AUTH_URL -os_identity_api_version=$OS_IDENTITY_API_VERSION -os_username=$OS_USERNAME -os_password=$OS_PASSWORD -os_project_name=$OS_PROJECT_NAME -os_user_domain_id=$OS_USER_DOMAIN_ID -os_project_domain_id=$OS_PROJECT_DOMAIN_ID -os_service_type=baremetal -os_endpoint_type=public -END -fi -tox -e functional diff --git a/tox.ini b/tox.ini index e179110dc..8e2b4d965 100644 --- a/tox.ini +++ b/tox.ini @@ -53,6 +53,7 @@ deps = commands = {posargs} [testenv:functional] +passenv = * setenv = TESTS_DIR=./ironicclient/tests/functional LANGUAGE=en_US diff --git a/zuul.d/ironicclient-jobs.yaml b/zuul.d/ironicclient-jobs.yaml new file mode 100644 index 000000000..1dde6c4e5 --- /dev/null +++ b/zuul.d/ironicclient-jobs.yaml @@ -0,0 +1,48 @@ +- job: + name: ironicclient-functional + parent: devstack-minimal + irrelevant-files: + - ^.*\.rst$ + - ^doc/.*$ + - ^ironicclient/locale/.*$ + - ^ironicclient/tests/.*$ + - ^releasenotes/.*$ + - ^setup.cfg$ + - ^tools/.*$ + - ^tox.ini$ + required-projects: + - openstack/ironic + - openstack/python-ironicclient + - openstack/keystone + - openstack/tempest + timeout: 4800 + post-run: playbooks/functional/run.yaml + vars: + tox_environment: + PYTHONUNBUFFERED: 'true' + tox_envlist: functional + devstack_plugins: + ironic: https://git.openstack.org/openstack/ironic + devstack_localrc: + USE_PYTHON3: False + EBTABLES_RACE_FIX: True + IRONIC_ENABLED_NETWORK_INTERFACES: noop + IRONIC_DHCP_PROVIDER: none + IRONIC_DEPLOY_DRIVER: fake + INSTALL_TEMPEST: False + devstack_services: + key: True + mysql: True + rabbit: True + + +- job: + name: ironicclient-tempest + parent: ironic-base + required-projects: + - openstack/python-ironicclient + timeout: 10800 + vars: + devstack_localrc: + USE_PYTHON3: True + EBTABLES_RACE_FIX: True diff --git a/zuul.d/legacy-ironicclient-jobs.yaml b/zuul.d/legacy-ironicclient-jobs.yaml deleted file mode 100644 index 6981ba1e2..000000000 --- a/zuul.d/legacy-ironicclient-jobs.yaml +++ /dev/null @@ -1,42 +0,0 @@ -- job: - name: ironicclient-dsvm-functional - parent: legacy-dsvm-base - irrelevant-files: - - ^.*\.rst$ - - ^doc/.*$ - - ^releasenotes/.*$ - required-projects: - - openstack-infra/devstack-gate - - openstack/ironic - - openstack/python-ironicclient - run: playbooks/legacy/ironicclient-dsvm-functional/run.yaml - post-run: playbooks/legacy/ironicclient-dsvm-functional/post.yaml - timeout: 4800 - -- job: - name: ironicclient-tempest-dsvm-src - # NOTE: We do not use 'legacy-ironic-dsvm-base' as it is simpler and - # less confusing to define it all here and use 'legacy-dsvm-base'. - parent: legacy-dsvm-base - irrelevant-files: - - ^test-requirements.txt$ - - ^.*\.rst$ - - ^doc/.*$ - - ^ironicclient/tests/.*$ - - ^releasenotes/.*$ - - ^setup.cfg$ - - ^tools/.*$ - - ^tox.ini$ - required-projects: - - openstack-infra/devstack-gate - - openstack/ironic - - openstack/ironic-lib - - openstack/ironic-python-agent - - openstack/ironic-tempest-plugin - - openstack/pyghmi - - openstack/python-ironicclient - - openstack/tempest - - openstack/virtualbmc - run: playbooks/legacy/ironicclient-tempest-dsvm-src/run.yaml - post-run: playbooks/legacy/ironicclient-tempest-dsvm-src/post.yaml - timeout: 10800 diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index 8d5ff9523..f5a5f52c6 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -12,10 +12,10 @@ - release-notes-jobs-python3 check: jobs: - - ironicclient-dsvm-functional - - ironicclient-tempest-dsvm-src + - ironicclient-functional + - ironicclient-tempest gate: queue: ironic jobs: - - ironicclient-dsvm-functional - - ironicclient-tempest-dsvm-src + - ironicclient-functional + - ironicclient-tempest