zuul-jobs/roles/ensure-tox/tasks/main.yaml
Ian Wienand 9c04709719 Revert "Revert "ensure-tox: use venv to install""
This reverts commit bac2bf6c45.

The problem was really that ensure-pip was giving us a
"ensure_pip_virtualenv_command" that didn't work on some systems.
Iaa3ecd05b64af6dd9b2ee17a39bcbe6cde8686ba fixes this underlying issue,
so we can revert to the original change that uses that to install the
tox environment.

Change-Id: I8ce9dceb721474d3220f6e72409481dc89875ee0
2020-05-11 11:10:09 +10:00

37 lines
930 B
YAML

- name: Install pip
include_role:
name: ensure-pip
vars:
ensure_pip_from_packages_with_python2: '{{ tox_prefer_python2 }}'
- name: Check if tox is installed
shell: |
command -v {{ tox_executable }} || exit 1
args:
executable: /bin/bash
register: tox_preinstalled
failed_when: false
- name: Export preinstalled tox_exectuable
set_fact:
tox_executable: '{{ tox_executable }}'
cacheable: true
when: tox_preinstalled.rc == 0
- name: Install tox to local env
when: tox_preinstalled.rc != 0
block:
- name: Install tox to local venv
pip:
name: tox
virtualenv_command: '{{ ensure_pip_virtualenv_command }}'
virtualenv: '{{ tox_venv_path }}'
- name: Export installed tox_executable path
set_fact:
tox_executable: '{{ tox_venv_path }}/bin/tox'
cacheable: true
- name: Output tox version
command: "{{ tox_executable }} --version"