zuul-jobs/roles/tox/tasks/main.yaml
Dirk Mueller df3a9882df Switch to TOX_CONSTRAINTS_FILE
This allows to use lower-constraints.txt more easily as input
when everyone has switched over.

Depends-On: https://review.opendev.org/660823

Change-Id: I3f957187ed4f29fcf88db99cb79fb33b21a8dd8d
2019-05-22 22:30:14 +02:00

41 lines
1.2 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:
TOX_CONSTRAINTS_FILE: "{{ tox_constraints_file }}"
# Backward compatibility, to be removed
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 }}"