zuul-jobs/test-playbooks/python/fetch-tox-output.yaml
Albin Vass 0515041465 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
2020-04-21 12:10:54 +02:00

70 lines
1.9 KiB
YAML

- hosts: all
pre_tasks:
# Run ensure-output-dirs now as it is not performed speculatively
- import_role:
name: ensure-output-dirs
- name: Simplify tox config
copy:
content: "{{ item.content }}"
dest: "{{ zuul.project.src_dir }}/{{ item.dest }}"
with_items:
- content: |
[testenv]
sitepackages = True
usedevelop = True
[testenv:venv]
commands = python -c 'exit(0)'
dest: tox.ini
- content: |
import setuptools
setuptools.setup()
dest: setup.py
- content: ""
dest: setup.cfg
- name: Generate tox results
include_role:
name: "{{ item }}"
with_items:
- ensure-tox
- ensure-python
- tox
tasks:
- import_role:
name: fetch-tox-output
vars:
tox_envlist: "ALL"
- block:
- name: Undo the log_path fact set by fetch-javascript-output
set_fact:
log_path: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}"
when: groups['all'] | length > 1
- name: Undo the log_path fact set log path for single node
set_fact:
log_path: "{{ zuul.executor.log_root }}"
when: groups['all'] | length == 1
- import_role:
name: fetch-output
when: zuul_use_fetch_output
post_tasks:
- name: Check for artifact on the test instance
stat:
path: "{{ ansible_user_dir }}/zuul-output/logs/tox/venv-0.log"
register: _test_artifact
failed_when: not _test_artifact.stat.exists
when: zuul_use_fetch_output
- name: Check for artifact on the executor
stat:
path: "{{ zuul.executor.log_root }}/tox/venv-0.log"
delegate_to: localhost
register: _executor_artifact
failed_when: not _executor_artifact.stat.exists