summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuigi Toscano <ltoscano@redhat.com>2019-08-08 18:32:24 +0200
committerLuigi Toscano <ltoscano@redhat.com>2019-08-08 18:32:24 +0200
commit27e0a32677cdfbae6439f8a30996726492632d84 (patch)
tree02a107f89ddf19b69c2967dd7644c948b2abdd00
parentc4b50a10b3970aaf2d2e675e2fe8fd9b9bd4496b (diff)
downloadpython-cinderclient-27e0a32677cdfbae6439f8a30996726492632d84.tar.gz
Migrate the functional job to Zuul v3
- rename it so that it follows the documented pattern (<project>-<specifier>); - remove the old job, including the hooks, hoping that no 3rd-party CI uses them. Change-Id: Ib690c4fa96354dc422576d76c1296b1d5ba3494d
-rw-r--r--.zuul.yaml22
-rwxr-xr-xcinderclient/tests/functional/hooks/post_test_hook.sh53
-rw-r--r--playbooks/legacy/cinderclient-dsvm-functional/post.yaml80
-rw-r--r--playbooks/legacy/cinderclient-dsvm-functional/run.yaml49
-rw-r--r--playbooks/post.yaml6
-rw-r--r--playbooks/python-cinderclient-functional.yaml14
-rw-r--r--roles/get-os-environment/defaults/main.yaml2
-rw-r--r--roles/get-os-environment/tasks/main.yaml12
8 files changed, 44 insertions, 194 deletions
diff --git a/.zuul.yaml b/.zuul.yaml
index 42cfad3..594163a 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -1,18 +1,16 @@
- job:
- name: cinderclient-dsvm-functional
- parent: legacy-dsvm-base
- run: playbooks/legacy/cinderclient-dsvm-functional/run.yaml
- post-run: playbooks/legacy/cinderclient-dsvm-functional/post.yaml
- timeout: 4200
- voting: false
+ name: python-cinderclient-functional
+ parent: devstack
+ run: playbooks/python-cinderclient-functional.yaml
+ post-run: playbooks/post.yaml
+ timeout: 4500
required-projects:
- - openstack/devstack-gate
- openstack/cinder
- openstack/python-cinderclient
- irrelevant-files:
- - ^.*\.rst$
- - ^doc/.*$
- - ^releasenotes/.*$
+ vars:
+ devstack_localrc:
+ USE_PYTHON3: true
+ VOLUME_BACKING_FILE_SIZE: 16G
- project:
templates:
@@ -27,6 +25,6 @@
- release-notes-jobs-python3
check:
jobs:
- - cinderclient-dsvm-functional
+ - python-cinderclient-functional
- openstack-tox-pylint:
voting: false
diff --git a/cinderclient/tests/functional/hooks/post_test_hook.sh b/cinderclient/tests/functional/hooks/post_test_hook.sh
deleted file mode 100755
index 91d04d6..0000000
--- a/cinderclient/tests/functional/hooks/post_test_hook.sh
+++ /dev/null
@@ -1,53 +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.
-
-# Default gate uses /opt/stack/new... but some of us may install differently
-STACK_DIR=$BASE/new/devstack
-
-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 CINDERCLIENT_DIR="$BASE/new/python-cinderclient"
-
-sudo chown -R $USER:stack $CINDERCLIENT_DIR
-
-# Get admin credentials
-cd $STACK_DIR
-source openrc admin admin
-
-# Go to the cinderclient dir
-cd $CINDERCLIENT_DIR
-
-# Run tests
-echo "Running cinderclient functional test suite"
-set +e
-# Preserve env for OS_ credentials
-sudo -E -H -u $USER tox -efunctional
-EXIT_CODE=$?
-set -e
-
-# Collect and parse result
-generate_testr_results
-exit $EXIT_CODE
diff --git a/playbooks/legacy/cinderclient-dsvm-functional/post.yaml b/playbooks/legacy/cinderclient-dsvm-functional/post.yaml
deleted file mode 100644
index dac8753..0000000
--- a/playbooks/legacy/cinderclient-dsvm-functional/post.yaml
+++ /dev/null
@@ -1,80 +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=**/*nose_results.html
- - --include=*/
- - --exclude=*
- - --prune-empty-dirs
-
- - 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=**/*testr_results.html.gz
- - --include=*/
- - --exclude=*
- - --prune-empty-dirs
-
- - 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=/.testrepository/tmp*
- - --include=*/
- - --exclude=*
- - --prune-empty-dirs
-
- - 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=**/*testrepository.subunit.gz
- - --include=*/
- - --exclude=*
- - --prune-empty-dirs
-
- - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
- synchronize:
- src: '{{ ansible_user_dir }}/workspace/'
- dest: '{{ zuul.executor.log_root }}/tox'
- mode: pull
- copy_links: true
- verify_host: true
- rsync_opts:
- - --include=/.tox/*/log/*
- - --include=*/
- - --exclude=*
- - --prune-empty-dirs
-
- - 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/cinderclient-dsvm-functional/run.yaml b/playbooks/legacy/cinderclient-dsvm-functional/run.yaml
deleted file mode 100644
index cc35d0e..0000000
--- a/playbooks/legacy/cinderclient-dsvm-functional/run.yaml
+++ /dev/null
@@ -1,49 +0,0 @@
-- hosts: all
- name: Autoconverted job legacy-cinderclient-dsvm-functional from old job gate-cinderclient-dsvm-functional-ubuntu-xenial-nv
- 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/devstack-gate
- dest: devstack-gate
- EOF
- /usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \
- https://opendev.org \
- openstack/devstack-gate
- executable: /bin/bash
- chdir: '{{ ansible_user_dir }}/workspace'
- environment: '{{ zuul | zuul_legacy_vars }}'
-
- - shell:
- cmd: |
- set -e
- set -x
- export PYTHONUNBUFFERED=true
- export BRANCH_OVERRIDE=default
- export DEVSTACK_PROJECT_FROM_GIT=python-cinderclient
- export DEVSTACK_LOCAL_CONFIG="VOLUME_BACKING_FILE_SIZE=16G"
- if [ "$BRANCH_OVERRIDE" != "default" ] ; then
- export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE
- fi
- if [ "" == "-identity-v3-only" ] ; then
- export DEVSTACK_LOCAL_CONFIG+=$'\n'"ENABLE_IDENTITY_V2=False"
- fi
- function post_test_hook {
- # Configure and run functional tests
- $BASE/new/python-cinderclient/cinderclient/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/post.yaml b/playbooks/post.yaml
new file mode 100644
index 0000000..9860e2a
--- /dev/null
+++ b/playbooks/post.yaml
@@ -0,0 +1,6 @@
+- hosts: all
+ vars:
+ tox_envlist: functional
+ roles:
+ - fetch-tox-output
+ - fetch-subunit-output
diff --git a/playbooks/python-cinderclient-functional.yaml b/playbooks/python-cinderclient-functional.yaml
new file mode 100644
index 0000000..ea7d2db
--- /dev/null
+++ b/playbooks/python-cinderclient-functional.yaml
@@ -0,0 +1,14 @@
+- hosts: all
+ roles:
+ - run-devstack
+ # Run bindep and test-setup after devstack so that they won't interfere
+ - role: bindep
+ bindep_profile: test
+ bindep_dir: "{{ zuul_work_dir }}"
+ - test-setup
+ - get-os-environment
+ - ensure-tox
+ - role: tox
+ tox_envlist: functional
+ tox_install_siblings: false
+ environment: "{{ os_env_vars }}"
diff --git a/roles/get-os-environment/defaults/main.yaml b/roles/get-os-environment/defaults/main.yaml
new file mode 100644
index 0000000..91190b3
--- /dev/null
+++ b/roles/get-os-environment/defaults/main.yaml
@@ -0,0 +1,2 @@
+---
+openrc_file: "{{ devstack_base_dir|default('/opt/stack') }}/devstack/openrc"
diff --git a/roles/get-os-environment/tasks/main.yaml b/roles/get-os-environment/tasks/main.yaml
new file mode 100644
index 0000000..b3f457b
--- /dev/null
+++ b/roles/get-os-environment/tasks/main.yaml
@@ -0,0 +1,12 @@
+- name: Extract the OS_ environment variables
+ shell:
+ cmd: |
+ source {{ openrc_file }} admin admin &>/dev/null
+ env | awk -F= 'BEGIN {print "---" } /^OS_/ { print " "$1": \""$2"\""} '
+ args:
+ executable: "/bin/bash"
+ register: env_os
+
+- name: Save the OS_ environment variables as a fact
+ set_fact:
+ os_env_vars: "{{ env_os.stdout|from_yaml }}"