Merge "Make fetch-tox-output more resilient"
This commit is contained in:
commit
c1fb3e9ed1
@ -1 +1,18 @@
|
||||
Collect output from a tox build
|
||||
Collect log output from a tox build
|
||||
|
||||
**Role Variables**
|
||||
|
||||
.. zuul:rolevar:: tox_envlist
|
||||
:default: all
|
||||
|
||||
Which tox environment to fetch log output from.
|
||||
|
||||
.. zuul:rolevar:: tox_executable
|
||||
:default: tox
|
||||
|
||||
Location of the tox executable.
|
||||
|
||||
.. zuul:rolevar:: zuul_work_dir
|
||||
:default: {{ zuul.project.src_dir }}
|
||||
|
||||
Directory tox was run in.
|
||||
|
@ -1,2 +1,5 @@
|
||||
---
|
||||
zuul_work_dir: "src/{{ zuul.project.canonical_name }}"
|
||||
tox_envlist: all
|
||||
tox_executable: tox
|
||||
|
||||
zuul_work_dir: "{{ zuul.project.src_dir }}"
|
||||
|
@ -1,12 +1,3 @@
|
||||
- name: Find tox directories to synchrionize
|
||||
find:
|
||||
file_type: directory
|
||||
paths: "{{ zuul_work_dir }}/.tox"
|
||||
# NOTE(pabelanger): The .tox/log folder is empty, ignore it.
|
||||
patterns: ^(?!log).*$
|
||||
use_regex: yes
|
||||
register: result
|
||||
|
||||
- name: Set tox log path for multiple nodes
|
||||
set_fact:
|
||||
log_path: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/tox"
|
||||
@ -23,10 +14,25 @@
|
||||
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
|
||||
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: "{{ item.path }}/log/"
|
||||
src: "{{ zuul_work_dir }}/.tox/{{ item }}/log/"
|
||||
verify_host: true
|
||||
with_items: "{{ result.files }}"
|
||||
with_items: "{{ envlist }}"
|
||||
|
@ -115,8 +115,12 @@ def main():
|
||||
tox_python = '{project_dir}/.tox/{envlist}/bin/python'.format(
|
||||
project_dir=project_dir, envlist=envlist)
|
||||
# Write a log file into the .tox dir so that it'll get picked up
|
||||
log_file = '{project_dir}/.tox/{envlist}/log/siblings.txt'.format(
|
||||
# Name it with envlist as a prefix so that fetch-tox-output will properly
|
||||
# get it in a multi-env scenario
|
||||
log_dir = '{project_dir}/.tox/{envlist}/log'.format(
|
||||
project_dir=project_dir, envlist=envlist)
|
||||
log_file = '{log_dir}/{envlist}-siblings.txt'.format(
|
||||
log_dir=log_dir, envlist=envlist)
|
||||
|
||||
log = list()
|
||||
log.append(
|
||||
|
@ -9,6 +9,7 @@
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
when: tox_install_siblings
|
||||
|
||||
# TODO(mordred) handle tox_envlist being a list
|
||||
- name: Install any sibling python packages
|
||||
tox_install_sibling_packages:
|
||||
tox_envlist: "{{ tox_envlist }}"
|
||||
|
Loading…
Reference in New Issue
Block a user