Create Tox InfraRed upstream job

Change-Id: Ib816520d63a51ae37a9be8f2036131bd58ecd054
This commit is contained in:
Federico Ressi 2020-01-07 16:13:19 +01:00
parent 7832a9d15c
commit a9e9d5ee60
8 changed files with 217 additions and 11 deletions

9
ansible.cfg Normal file
View File

@ -0,0 +1,9 @@
[defaults]
host_key_checking = False
forks = 500
timeout = 30
force_color = 1
[ssh_connection]
pipelining = True
ssh_args = -o ControlMaster=auto -o ControlPersist=60s

View File

@ -1,14 +1,24 @@
# This file contains runtime (non-python) dependencies
# More info at: https://docs.openstack.org/infra/bindep/readme.html
libffi-dev [platform:dpkg]
libffi-devel [platform:rpm]
gcc [platform:rpm]
gcc [platform:dpkg]
python3 [platform:dpkg]
python3 [platform:rpm]
python3-dev [platform:dpkg]
python3-devel [platform:rpm]
git [platform:dpkg]
git [platform:rpm]
iproute [platform:rpm]
libffi-devel [platform:rpm]
libffi-dev [platform:dpkg]
libselinux-python [platform:rpm]
openssl-devel [platform:rpm]
libssl-dev [platform:dpkg]
iproute [platform:rpm]
python3 [platform:rpm]
python3 [platform:dpkg]
python3-devel [platform:rpm]
python3-dev [platform:dpkg]

72
infrared/plugin.spec Normal file
View File

@ -0,0 +1,72 @@
---
config:
plugin_type: test
entry_point: ../roles/tobiko/main.yml
subparsers:
tobiko:
description: Configure and Run Tobiko Test Cases
include_groups:
- "Ansible options"
- "Inventory"
- "Common options"
- "Answers file"
groups:
- title: Stages Control
options:
pre_run:
type: Bool
help: install and configure Tobiko test cases
run_tests:
type: Bool
help: run verification test cases
run_faults:
type: Bool
help: run disruptive operation test cases
post_run:
type: Bool
help: fetch artifacts after test case execution
- title: Install Options
options:
tox_dir:
type: Value
default: "{{ ansible_env.HOME }}/tobiko"
help: |
The directory where Tobiko will be installed and used
overcloudrc:
type: Value
default: "{{ ansible_env.HOME }}/overcloudrc"
help: |
The path to the overcloudrc file
floating_network:
type: Value
default: "public"
help: |
Name of overcloud's floating_network
tests:
type: Value
help: |
The set of tests to execute
default: scenario
results_dir_suffix:
type: Value
help: |
Suffix string to add to tobiko_results dir
example : default will be tobiko_results_1st
default: "1st"
refsec:
type: Value
help: |
specific gerrit patch refsec to
checkout, example:
--refsec refs/changes/66/665966/7
default: ''

View File

@ -0,0 +1,7 @@
---
- hosts: all
tasks:
- debug:
msg: |
TODO(fressi): prepare here host before executing tox -e infrared

71
tools/ci/ir Executable file
View File

@ -0,0 +1,71 @@
#!/bin/bash
source $(dirname "$0")/activate
source $(dirname "$0")/tox
set -eu
IR_VIRTUAL_ENV=$(realpath "${IR_VIRTUAL_ENV:-.tox/infrared}")
IR_REPO="https://github.com/redhat-openstack/infrared.git"
IR_BRANCH=${IR_BRANCH:-master}
IR_SOURCE_DIR=$(realpath "${IR_SOURCE_DIR:-${IR_VIRTUAL_ENV}/infrared}")
IR_EXECUTABLE=${IR_VIRTUAL_ENV}/bin/infrared
export IR_HOME=$(realpath ${IR_HOME:-../.infrared/})
IR_TOBIKO_PLUGIN=$(realpath ${IR_TOBIKO_PLUGIN:-$(pwd)})
function ir {
ir_setup
"${IR_EXECUTABLE}" "$@"
}
function ir_setup {
if ! ir_activate; then
tox -e infrared --notest
ir_activate
fi
if ! [ -x "${IR_EXECUTABLE}" ]; then
git clone "${IR_REPO}" -b "${IR_BRANCH}" "${IR_SOURCE_DIR}"
local package_name
for package_name in pip setuptools "${IR_SOURCE_DIR}"; do
pip install --upgrade "${package_name}"
done
(
cd "${IR_SOURCE_DIR}"
"${IR_EXECUTABLE}" plugin list --available --versions || true
"${IR_EXECUTABLE}" plugin remove tobiko || true
"${IR_EXECUTABLE}" plugin add "${IR_TOBIKO_PLUGIN}"
)
fi
mkdir -p "${IR_HOME}"
}
function ir_activate {
local venv_script=${IR_VIRTUAL_ENV}/bin/activate
if ! [ -r "${venv_script}" ]; then
return 1
fi
if ! ir_is_active; then
# Activate only once
set +eu
source "${venv_script}"
set -eu
ir_is_active
fi
}
function ir_is_active {
[ "$(python_prefix)" == "${IR_VIRTUAL_ENV}" ]
}
if [ $(basename "$0") == ir ]; then
ir "$@"
fi

27
tox.ini
View File

@ -12,6 +12,7 @@ deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
-r{toxinidir}/requirements.txt
passenv =
PS1
TOBIKO_*
setenv =
OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
@ -21,6 +22,7 @@ setenv =
PYTHONWARNINGS=ignore::Warning,{env:PYTHONWARNINGS:}
TOBIKO_PREVENT_CREATE={env:TOBIKO_PREVENT_CREATE:false}
VIRTUAL_ENV={envdir}
PS1=[tobiko@{envname}] {env:PS1:}
commands =
stestr run {posargs}
@ -106,12 +108,15 @@ import-order-style = pep8
[openstack]
basepython = {env:PYTHON:python3}
deps = {[base]deps}
deps =
{[base]deps}
passenv =
{[base]passenv}
*_proxy
OS_*
setenv = {[base]setenv}
setenv =
{[base]setenv}
ANSIBLE_CONFIG={env:ANSIBLE_CONFIG:{toxinidir}/ansible.cfg}
commands = {[base]commands}
@ -168,7 +173,23 @@ deps = {[testenv:scenario]deps}
passenv = {[testenv:scenario]passenv}
setenv = {[testenv:scenario]setenv}
whitelist_externals = *
commands = {posargs}
commands = {posargs:bash}
[testenv:infrared]
basepython = {[testenv:venv]basepython}
deps = {[testenv:venv]deps}
passenv =
{[testenv:venv]passenv}
IR_*
setenv =
{[testenv:venv]setenv}
IR_HOME={env:IR_HOME:{toxinidir}/../.infrared}
IR_TOBIKO_PLUGIN={env:IR_TOBIKO_PLUGIN:{toxinidir}}
whitelist_externals = *
commands =
bash {toxinidir}/tools/ci/ir {posargs:tobiko}
# --- documentation environments ----------------------------------------------

16
zuul.d/infrared.yaml Normal file
View File

@ -0,0 +1,16 @@
---
- job:
name: tobiko-tox-infrared-centos-7
parent: openstack-tox
voting: false
nodeset: centos-7
timeout: 2400
description: |
Run tobiko infrared plugin
vars:
tox_envlist: infrared
bindep_profile: test
python_version: 3.6
# compile and install python3.8 from source code
pre-run: playbooks/infrared/pre.yaml

View File

@ -18,7 +18,7 @@
- tobiko-devstack-functional
- tobiko-devstack-faults-centos-7
- tobiko-devstack-faults-ubuntu-bionic
- tobiko-tox-infrared-centos-7
gate:
jobs:
- tobiko-tox-py36-centos-7