zuul-jobs/roles/fetch-tox-output/tasks/main.yaml
Monty Taylor 8d11a04914
Change in to work dir before executing tox
We can't execute tox if we're not in the dir.

Change-Id: I8b6785a99f8a95b2fd9eaaad5c376a837c81154a
2017-10-01 13:50:42 -05:00

41 lines
1.0 KiB
YAML

- name: Set tox log path for multiple nodes
set_fact:
log_path: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/tox"
when: groups['all'] | length > 1
- name: Set tox log path for single node
set_fact:
log_path: "{{ zuul.executor.log_root }}/tox"
when: log_path is not defined
- name: Ensure local tox dir
file:
path: "{{ log_path }}"
state: directory
delegate_to: localhost
- name: Set envlist fact
set_fact:
envlist: "{{ tox_envlist.split(',') }}"
when: tox_envlist is defined
- name: Find all environments
command: tox -l
args:
chdir: "{{ zuul_work_dir }}"
register: tox_environments
when: tox_envlist is not defined or tox_envlist == 'all'
- name: Set envlist fact
set_fact:
envlist: "{{ tox_environments.stdout_lines }}"
when: tox_envlist is not defined or tox_envlist == 'all'
- name: Collect tox logs
synchronize:
dest: "{{ log_path }}"
mode: pull
src: "{{ zuul_work_dir }}/.tox/{{ item }}/log/"
verify_host: true
with_items: "{{ envlist }}"