Merge "install-javascript-packages: add tox_constraints_file"
This commit is contained in:
commit
3cbce518ad
@ -6,3 +6,9 @@ Install javascript dependencies needed for a project
|
||||
:default: {{ zuul.project.src_dir }}
|
||||
|
||||
The directory to work in.
|
||||
|
||||
.. zuul:rolevar:: tox_constraints_file
|
||||
|
||||
Path to a pip constraints file. Will set the
|
||||
``UPPER_CONSTRAINTS_FILE`` environment variable. Useful if npm
|
||||
``postinstall`` runs tox.
|
||||
|
@ -1 +1,3 @@
|
||||
npm_environment:
|
||||
DISPLAY: ':99'
|
||||
zuul_work_dir: "{{ zuul.project.src_dir }}"
|
||||
|
@ -1,3 +1,25 @@
|
||||
- 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: Check for yarn.lock file
|
||||
stat:
|
||||
path: "{{ zuul_work_dir }}/yarn.lock"
|
||||
@ -16,8 +38,7 @@
|
||||
|
||||
- name: Install npm dependencies
|
||||
command: npm install --verbose
|
||||
environment:
|
||||
DISPLAY: ':99'
|
||||
environment: "{{ npm_environment|combine(tox_constraints_env|default({})) }}"
|
||||
args:
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
when: not yarn_lock.stat.exists
|
||||
|
Loading…
Reference in New Issue
Block a user