zuul-jobs/roles/fetch-tox-output/tasks/main.yaml
Albin Vass a78060213a fetch-tox-output: do not synchronize owner
Change-Id: I49a744d6949da4623f7553b6ae05e84253dbe5bd
2020-05-18 17:05:32 +02:00

80 lines
2.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: Ensure zuul-output tox dir
file:
path: "{{ zuul_output_dir }}/logs/tox"
state: directory
when: zuul_use_fetch_output
- name: Set envlist fact
set_fact:
envlist: "{{ tox_envlist.split(',') }}"
when: tox_envlist is defined and tox_envlist != 'ALL' and tox_envlist
- name: Find all default environments
command: "{{ tox_executable }} -l"
args:
chdir: "{{ zuul_work_dir }}"
register: tox_environments
when: tox_envlist is not defined or
not tox_envlist
- name: Find all default environments
command: "{{ tox_executable }} -a"
args:
chdir: "{{ zuul_work_dir }}"
register: tox_environments
when:
- tox_envlist is defined
- tox_envlist == 'ALL'
- name: Set envlist fact
set_fact:
envlist: "{{ tox_environments.stdout_lines }}"
when: tox_envlist is not defined or
not tox_envlist or
tox_envlist == 'ALL'
- name: Copy tox logs
copy:
dest: "{{ zuul_output_dir }}/logs/tox/"
src: "{{ zuul_work_dir }}/.tox/{{ zj_testenv }}/log/"
remote_src: true
loop: "{{ envlist }}"
loop_control:
loop_var: zj_testenv
# some tox runs may not create a virtualenv and thus have
# no ./tox/env directory
failed_when: false
when: zuul_use_fetch_output
- name: Collect tox logs
synchronize:
dest: "{{ log_path }}"
mode: pull
src: "{{ zuul_work_dir }}/.tox/{{ zj_testenv }}/log/"
verify_host: true
owner: no
group: no
loop: "{{ envlist }}"
loop_control:
loop_var: zj_testenv
# some tox runs may not create a virtualenv and thus have
# no ./tox/env directory
failed_when: false
when: not zuul_use_fetch_output