[ci] Install tox for tox-functional job
Change-Id: I96b9ce7a0c3aec07d1f4d96a3acb1342b255d884
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 }}
|
||||
@@ -12,4 +12,4 @@
|
||||
rally_task: "rally-jobs/simple-job.yaml"
|
||||
roles:
|
||||
- prepare-for-rally-task
|
||||
- run-rally-tox
|
||||
- tox-run
|
||||
64
tests/ci/playbooks/tox-install.yaml
Normal file
64
tests/ci/playbooks/tox-install.yaml
Normal 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
|
||||
Reference in New Issue
Block a user