Honor constraints files in tox-siblings
We use the constraints file when we do the actual sibling installation, but not when we do the initial no-test install. That could lead to something being installed at the wrong version and not getting updated subsequently. Shifted the siblings logic into a file that's conditionally included so we can avoid a bunch of if defined additions. Change-Id: I4e71ab2ea8e167f22c3a66b95dc6f898a35f0284
This commit is contained in:
parent
a1373c48c6
commit
43943c5bb0
@ -1,19 +1,3 @@
|
|||||||
- name: Require tox_envlist variable
|
- name: Install tox siblings
|
||||||
fail:
|
include: siblings.yaml
|
||||||
msg: tox_envlist is required for this role
|
|
||||||
when: tox_envlist is not defined
|
|
||||||
|
|
||||||
- name: Run tox without tests
|
|
||||||
command: "{{ tox_executable }} --notest -e{{ tox_envlist }}"
|
|
||||||
args:
|
|
||||||
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 }}"
|
|
||||||
tox_constraints_file: "{{ tox_constraints_file | default(omit) }}"
|
|
||||||
project_dir: "{{ zuul_work_dir }}"
|
|
||||||
projects: "{{ zuul.projects | selectattr('required') | list }}"
|
|
||||||
when: tox_install_siblings
|
when: tox_install_siblings
|
||||||
|
38
roles/tox-siblings/tasks/siblings.yaml
Normal file
38
roles/tox-siblings/tasks/siblings.yaml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
- 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: Run tox without tests
|
||||||
|
command: "{{ tox_executable }} --notest -e{{ tox_envlist }}"
|
||||||
|
args:
|
||||||
|
chdir: "{{ zuul_work_dir }}"
|
||||||
|
environment: "{{ tox_environment|combine(tox_constraints_env|default({})) }}"
|
||||||
|
|
||||||
|
# TODO(mordred) handle tox_envlist being a list
|
||||||
|
- name: Install any sibling python packages
|
||||||
|
tox_install_sibling_packages:
|
||||||
|
tox_envlist: "{{ tox_envlist }}"
|
||||||
|
tox_constraints_file: "{{ tox_constraints_file | default(omit) }}"
|
||||||
|
project_dir: "{{ zuul_work_dir }}"
|
||||||
|
projects: "{{ zuul.projects | selectattr('required') | list }}"
|
Loading…
Reference in New Issue
Block a user