zuul-jobs/roles/tox/tasks/main.yaml
Monty Taylor d7cba9d7d5
Combine tox-siblings and tox roles
There is a bunch of duplicate logic between tox and tox-siblings, the
tox-siblings logic is already protected with a flag - and having them be
split already led to not doing the right thing with constraints files in
siblings when we did it right in tox itself.

Combine them into one role.

This means the siblings code will run as part of run instead of as part
of pre- but that's how things have worked for years anyway until
siblings was introduced - and is also the behavior is the siblings flag
is false -so it's more consistent overall.

Leave a no-op tox-siblings role so that we can gracefully remove the use of
tox-siblings from castellan, python-openstacksdk, shade and tacker.

Change-Id: Id61ae52d48b28cfc2221cb556a1c1f7c6dfd60dd
2017-11-29 15:34:08 -06:00

39 lines
1.1 KiB
YAML

- name: Require tox_envlist variable
fail:
msg: tox_envlist is required for this role
when: tox_envlist is not defined
- name: Check to see if the constraints file exists
stat:
path: "{{ tox_constraints_file }}"
get_checksum: false
get_mime: false
get_md5: false
register: stat_results
when: tox_constraints_file is defined
- name: Fail if constraints file is missing
when: tox_constraints_file is defined and not stat_results.stat.exists
fail:
msg: tox_constraints_file is defined but was not found
- name: Record file location
set_fact:
tox_constraints_env:
UPPER_CONSTRAINTS_FILE: "{{ tox_constraints_file }}"
when: tox_constraints_file is defined
- name: Install tox siblings
include: siblings.yaml
when: tox_install_siblings
- name: Emit tox command
debug:
msg: "Running tox: {{ tox_executable }} -e{{ tox_envlist }} {{ tox_extra_args }}"
- name: Run tox
args:
chdir: "{{ zuul_work_dir }}"
environment: "{{ tox_environment|combine(tox_constraints_env|default({})) }}"
command: "{{ tox_executable }} -e{{ tox_envlist }} {{ tox_extra_args }}"