[ci] Manage tox job manually

Patch Ia56cba58c87aa48de3e8e3f3d28f6252f7dcd7c3 introduced a new role
'ensure-python' which checks for installed python version before our
pre-run playbook can install not-default versions. Such change broke our
py34 job.

To continue checking Python 3.4 and ensure that everything is done as we
wish let's do not use global 'tox' job and implement the custom one.

The new rally-tox-base job checks tox.ini for required python version
and installs it via 'apt'. Also, there is new post playbook which
publishes the results of execution.

Change-Id: Ia69d36670ff07079c82c9b1fef54d8ade62c7c7b
This commit is contained in:
Andrey Kurilin 2018-10-22 16:39:43 +03:00
parent 910478f808
commit 3ed8ac0e93
9 changed files with 179 additions and 59 deletions

View File

@ -1,56 +1,98 @@
- job:
name: rally-tox-functional
parent: tox
name: rally-tox-base
parent: unittests
pre-run: tests/ci/playbooks/rally-tox-base/pre-run.yaml
run: tests/ci/playbooks/rally-tox-base/run.yaml
post-run: tests/ci/playbooks/rally-tox-base/post-run.yaml
description: |
Run test for rally project.
- job:
name: rally-tox-docs
parent: rally-tox-base
description: |
Run test for rally project.
Uses tox with the ``self`` environment.
vars:
tox_envlist: functional
tox_env: docs
- job:
name: rally0-tox-pep8
parent: rally-tox-base
description: |
Run test for rally project.
Uses tox with the ``self`` environment.
vars:
tox_env: pep8
- job:
name: rally-tox-functional
parent: rally-tox-base
description: |
Run test for rally project.
Uses tox with the ``functional`` environment.
vars:
tox_env: functional
- job:
name: rally-tox-self
parent: tox
parent: rally-tox-base
description: |
Run test for rally project.
Uses tox with the ``self`` environment.
vars:
tox_envlist: self
tox_env: self
- job:
name: rally-tox-py34
parent: tox
nodeset: ubuntu-bionic
pre-run: tests/ci/playbooks/pre-run-tox.yaml
name: rally0-tox-py27
parent: rally-tox-base
description: |
Run unit test for rally project.
Uses tox with the ``py34`` environment.
vars:
tox_envlist: py34
python_version: 3.4
tox_env: py27
- job:
name: rally-tox-py34
parent: rally-tox-base
description: |
Run unit test for rally project.
Uses tox with the ``py34`` environment.
vars:
tox_env: py34
- job:
name: rally0-tox-py35
parent: rally-tox-base
description: |
Run unit test for rally project.
Uses tox with the ``py35`` environment.
vars:
tox_env: py35
- job:
name: rally-tox-py36
parent: tox
nodeset: ubuntu-bionic
parent: rally-tox-base
description: |
Run unit test for rally project.
Uses tox with the ``py36`` environment.
vars:
tox_envlist: py36
tox_env: py36
- job:
name: rally-tox-py37
parent: tox
nodeset: ubuntu-bionic
pre-run: tests/ci/playbooks/pre-run-tox.yaml
parent: rally-tox-base
description: |
Run unit test for rally project.
Uses tox with the ``py37`` environment.
vars:
tox_envlist: py37
python_version: 3.7
tox_env: py37

View File

@ -27,32 +27,37 @@
timeout: 1800
- project:
templates:
- openstack-python-jobs
- openstack-python35-jobs
- publish-openstack-docs-pti
#templates:
# - publish-openstack-docs-pti
check:
jobs:
- rally-tox-docs
- rally0-tox-pep8
- rally0-tox-py27
- rally-tox-py34
- rally0-tox-py35
- rally-tox-py36
- rally-tox-py37
- rally-tox-cover
- rally-tox-functional
- rally-database-migration
- rally-install-ubuntu-xenial
- rally-install-ubuntu-bionic
- rally-install-centos-7
- rally-tox-cover
- rally-tox-functional
- rally-tox-py34
- rally-tox-py36
- rally-tox-py37
- rally-tox-self
gate:
jobs:
- rally-tox-docs
- rally0-tox-pep8
- rally0-tox-py27
- rally-tox-py34
- rally0-tox-py35
- rally-tox-py36
- rally-tox-py37
- rally-tox-cover
- rally-tox-functional
- rally-database-migration
- rally-install-ubuntu-xenial
- rally-install-ubuntu-bionic
- rally-install-centos-7
- rally-tox-cover
- rally-tox-functional
- rally-tox-py34
- rally-tox-py36
- rally-tox-py37
- rally-tox-self

View File

@ -1,3 +1,2 @@
rally-openstack
# we are using theme from it
oslosphinx

View File

@ -1,15 +0,0 @@
- hosts: all
name: Installs all required packages
tasks:
- name: Install the proper python version
become: True
become_user: root
shell:
executable: /bin/sh
cmd: |
set -e
add-apt-repository ppa:deadsnakes/ppa --yes
apt-get update
apt-get install python{{python_version}}-dev --yes

View File

@ -0,0 +1,23 @@
- hosts: all
vars:
results_dir: "{{ zuul.project.src_dir }}/.test_results/"
tasks:
- name: Check the existence of results dir
stat:
path: '{{ results_dir }}'
register: results_dir_stat
- name: Save results
become: yes
when: results_dir_stat.stat.exists == True
synchronize:
src: "{{ results_dir }}"
dest: '{{ zuul.executor.log_root }}/'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=/**
- --include=*/
- --exclude=*
- --prune-empty-dirs

View File

@ -0,0 +1,62 @@
- hosts: all
name: Installs all required packages
tasks:
- name: Check required version of Python
args:
chdir: "{{ zuul.project.src_dir }}"
shell:
executable: /bin/sh
cmd: |
set -e
iniget(){
local xtrace
xtrace=$(set +o | grep xtrace)
set +o xtrace
local section=$1
local file="tox.ini"
local option="basepython"
local line
line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file")
echo ${line#*= python}
$xtrace
}
tox_testenv_python=$(iniget 'testenv:{{ tox_env }}')
if [ "$tox_testenv_python" != "" ]; then
echo $tox_testenv_python
else
echo $(iniget 'testenv')
fi
register: python_version
- name: Install the proper python version
become: True
become_user: root
shell:
executable: /bin/sh
cmd: |
set -e
add-apt-repository ppa:deadsnakes/ppa --yes
apt-get update
apt-get install python{{ python_version.stdout }}-dev --yes
- name: Install the proper python pip version
become: True
become_user: root
shell:
executable: /bin/sh
cmd: |
set -e
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python{{ python_version.stdout }} get-pip.py
- name: Install python tox
become: True
become_user: root
command: pip{{ python_version.stdout }} install tox
roles:
- bindep

View File

@ -0,0 +1,6 @@
- hosts: all
tasks:
- name: Run tox
args:
chdir: "{{ zuul.project.src_dir }}"
command: "tox -e{{ tox_env }}"

View File

@ -14,13 +14,11 @@
TASK_FILE=$1
PLUGIN_PATHS=rally-jobs/plugins
if [ -n "$ZUUL_PROJECT" ]; then
HTML_REPORT=testr_results.html
JSON_REPORT=testr_results.json
else
HTML_REPORT=rally_self_results.html
JSON_REPORT=rally_self_results.json
fi
mkdir -p .test_results
HTML_REPORT=.test_results/rally_self_report.html
JSON_REPORT=.test_results/rally_self_results.json
RND=$(head /dev/urandom | tr -dc a-z0-9 | head -c 5)
TMP_RALLY_CONF="/tmp/self-rally-$RND.conf"
TMP_RALLY_DB="/tmp/self-rally-$RND.sqlite"
@ -33,7 +31,7 @@ sed -i.bak "s|#connection =.*|connection = \"$DBCONNSTRING\"|" $TMP_RALLY_CONF
rally --config-file $TMP_RALLY_CONF db create
# Create self deployment
$RALLY -d deployment create --name=self
$RALLY -d env create --name=self
# Run task
$RALLY -d --plugin-paths=$PLUGIN_PATHS task start $TASK_FILE

View File

@ -24,7 +24,7 @@ commands =
python {toxinidir}/tests/ci/pytest_launcher.py tests/unit --posargs={posargs}
distribute = false
basepython = python2.7
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
passenv = PYTEST_REPORT http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
[testenv:pep8]
commands = flake8