Andrey Kurilin 29c368f989 [ci] Unblock CI
* Remove listing nova agents from osresources. This API is not available
  anymore
* move tox installation from pre playbook to a role

Change-Id: Ic51f5c82e4ca89b997e2eb1d3d919661061c851f
2021-02-03 22:15:50 +02:00

59 lines
1.3 KiB
YAML

- 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