Run tox in venv in case of building images

tox depends on virtualenv, when it's installed using pip - it tries to upgrade
virtualenv, and then fails.

Change-Id: Ic9566778f87f8b81563ed012e651cef50d1baa38
This commit is contained in:
Michal Nasiadka 2020-06-18 17:24:16 +02:00
parent 872a0552f0
commit f3ba8d5f23
3 changed files with 11 additions and 1 deletions

View File

@ -36,6 +36,14 @@
- python-virtualenv
- python-wheel
- name: Install virtualenv on Debian systems
package:
name:
- virtualenv
become: true
when:
ansible_os_family == "Debian"
- name: Ensure latest pip is installed
become: true
pip:

View File

@ -47,6 +47,7 @@
- name: Ensure tox is installed
pip:
name: tox
virtualenv: "{{ ansible_env.HOME }}/tox-venv"
when: need_build_image
become: true
@ -191,6 +192,7 @@
TAG: "{{ build_image_tag }}"
KOLLA_SRC_DIR: "{{ ansible_env.HOME }}/src/opendev.org/openstack/kolla"
ACTION: "{{ scenario }}"
TOX_VENV: "{{ ansible_env.HOME }}/tox-venv"
UPPER_CONSTRAINTS: "{{ ansible_env.HOME }}/src/opendev.org/openstack/requirements/upper-constraints.txt"
# At this point we have generated all necessary configuration, and are

View File

@ -150,7 +150,7 @@ function prepare_images {
fi
sudo docker run -d -p 4000:5000 --restart=always -v /opt/kolla_registry/:/var/lib/registry --name registry registry:2
pushd "${KOLLA_SRC_DIR}"
sudo tox -e "build-${BASE_DISTRO}-${INSTALL_TYPE}"
sudo $TOX_VENV/bin/tox -e "build-${BASE_DISTRO}-${INSTALL_TYPE}"
popd
}