Use cached 'tox_executable' in fetch-tox-output

Otherwise this role could fail when tox is not installed in PATH.

Also updates the default behaviour to only collect the environments
configured with 'envlist' in tox.ini and collects all environments if
the envlist is set to 'ALL'.

Change-Id: I60bcc25cb853d2db3ee767a719b9ac54e421532e
This commit is contained in:
Albin Vass 2020-04-20 10:01:33 +02:00 committed by vass
parent 8f06e1a536
commit 0515041465
4 changed files with 34 additions and 4 deletions

View File

@ -25,17 +25,24 @@
envlist: "{{ tox_envlist.split(',') }}"
when: tox_envlist is defined
- name: Find all environments
command: tox -l
- name: Find all default environments
command: "{{ tox_executable }} -l"
args:
chdir: "{{ zuul_work_dir }}"
register: tox_environments
when: tox_envlist is not defined or tox_envlist|lower == 'all'
when: tox_envlist is not defined
- name: Find all default environments
command: "{{ tox_executable }} -a"
args:
chdir: "{{ zuul_work_dir }}"
register: tox_environments
when: tox_envlist == 'ALL'
- name: Set envlist fact
set_fact:
envlist: "{{ tox_environments.stdout_lines }}"
when: tox_envlist is not defined or tox_envlist|lower == 'all'
when: tox_envlist is not defined or tox_envlist == 'ALL'
- name: Copy tox logs
copy:

View File

@ -35,6 +35,8 @@
tasks:
- import_role:
name: fetch-tox-output
vars:
tox_envlist: "ALL"
- block:
- name: Undo the log_path fact set by fetch-javascript-output

View File

@ -0,0 +1,17 @@
- hosts: all
name: Remove any pre-installed tox
tasks:
- name: Remove tox package with pip
shell: pip uninstall -y tox
become: true
failed_when: false
- name: Remove tox package with pip3
shell: pip3 uninstall -y tox
become: true
failed_when: false
- name: Verify tox is not installed
command: "tox --version"
register: result
failed_when: result.rc == 0
roles:
- ensure-tox

View File

@ -250,6 +250,10 @@
- roles/ensure-output-dirs/.*
- roles/fetch-tox-output/.*
- roles/fetch-output/.*
- roles/ensure-tox/.*
- test-playbooks/python/fetch-tox-output.yaml
- test-playbooks/tox/reinstall-tox.yaml
pre-run: test-playbooks/tox/reinstall-tox.yaml
run: test-playbooks/python/fetch-tox-output.yaml
vars:
zuul_use_fetch_output: true