zuul-jobs/playbooks/javascript/pre.yaml

35 lines
901 B
YAML

- hosts: all
tasks:
- name: Set node version if not set
set_fact:
node_version: '14'
when: node_version is not defined
- name: Check for yarn.lock
when: js_build_tool is not defined
stat:
path: "{{ zuul_work_dir }}/yarn.lock"
get_checksum: false
get_mime: false
get_md5: false
register: yarn_lock_exists
- name: Set js_build_tool fact
set_fact:
js_build_tool: '{{ yarn_lock_exists.stat.exists | ternary("yarn", "npm") }}'
when: js_build_tool is not defined
- name: Ensure yarn if needed
include_role:
name: ensure-yarn
when: js_build_tool == 'yarn'
- name: Ensure nodejs if needed
include_role:
name: ensure-nodejs
when: js_build_tool == 'npm'
- name: Install javascript depends
include_role:
name: ensure-javascript-packages