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
This commit is contained in:
Luigi Toscano 2019-08-08 18:32:24 +02:00
parent c4b50a10b3
commit 27e0a32677
8 changed files with 44 additions and 194 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 }}'

6
playbooks/post.yaml Normal file
View File

@ -0,0 +1,6 @@
- hosts: all
vars:
tox_envlist: functional
roles:
- fetch-tox-output
- fetch-subunit-output

View File

@ -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 }}"

View File

@ -0,0 +1,2 @@
---
openrc_file: "{{ devstack_base_dir|default('/opt/stack') }}/devstack/openrc"

View File

@ -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 }}"