Browse Source

Merge "[ci] Install tox for tox-functional job"

changes/34/736434/1
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
fc0249f50a
4 changed files with 69 additions and 4 deletions
  1. +3
    -2
      .zuul.d/rally-tox-functional.yaml
  2. +1
    -1
      tests/ci/playbooks/roles/tox-run/tasks/main.yaml
  3. +1
    -1
      tests/ci/playbooks/tox-functional-env-run.yaml
  4. +64
    -0
      tests/ci/playbooks/tox-install.yaml

+ 3
- 2
.zuul.d/rally-tox-functional.yaml View File

@@ -19,5 +19,6 @@
rally-openstack: https://opendev.org/openstack/rally-openstack
devstack_localrc:
USE_PYTHON3: true
rally_tox_env: "functional"
run: tests/ci/playbooks/run-rally-tox.yaml
tox_env: "functional"
pre-run: tests/ci/playbooks/tox-install.yaml
run: tests/ci/playbooks/tox-functional-env-run.yaml

tests/ci/playbooks/roles/run-rally-tox/tasks/main.yaml → tests/ci/playbooks/roles/tox-run/tasks/main.yaml View File

@@ -7,4 +7,4 @@
set -e
cd /opt/stack/rally-openstack
export REQUESTS_CA_BUNDLE=/opt/stack/data/ca-bundle.pem
tox -e {{ rally_tox_env }}
tox -e {{ tox_env }}

tests/ci/playbooks/run-rally-tox.yaml → tests/ci/playbooks/tox-functional-env-run.yaml View File

@@ -12,4 +12,4 @@
rally_task: "rally-jobs/simple-job.yaml"
roles:
- prepare-for-rally-task
- run-rally-tox
- tox-run

+ 64
- 0
tests/ci/playbooks/tox-install.yaml View File

@@ -0,0 +1,64 @@

- 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

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/bash
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
shell:
executable: /bin/bash
cmd: |
pip{{ python_version.stdout }} install tox
roles:
- bindep

Loading…
Cancel
Save