zuul-jobs/roles/fetch-javascript-output/tasks/main.yaml
Lukas Kranz d8ec17cab0 Remove get_md5 parameter from stat module.
The get_md5 parameter was removed with ansible 9.
https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_9.html#id44

If it is being used the following error appears:
"Unsupported parameters for (stat) module: get_md5..."

Unrelated, but also blocking testing/merging of this change, the
Ansible version specs for older python versions is loosened
to allow installing older versions of Ansible on test nodes (like
focal) that have older pythons that are unsupported by newer Ansible.

Change-Id: I99dd4f16fde659d84eb3dfa191557b3d9508b0fb
2024-08-01 07:12:17 -07:00

159 lines
3.6 KiB
YAML

- name: Set log path for multiple nodes
set_fact:
log_path: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/npm"
cover_path: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/cover/"
when: groups['all'] | length > 1
- name: Set log path for single node
set_fact:
log_path: "{{ zuul.executor.log_root }}/npm"
cover_path: "{{ zuul.executor.log_root }}/cover/"
when: log_path is not defined
- name: Ensure local tox dir
file:
path: "{{ log_path }}"
state: directory
mode: 0755
delegate_to: localhost
- name: Check for yarn.lock
stat:
path: "{{ zuul_work_dir }}/yarn.lock"
get_checksum: false
get_mime: false
register: yarn_lock
- name: Check for shrinkwrap
stat:
path: "{{ zuul_work_dir }}/npm-shrinkwrap.json"
get_checksum: false
get_mime: false
when: not yarn_lock.stat.exists
register: shrinkwrap
- name: Run npm prune because of https://github.com/npm/npm/issues/6298
when:
- not yarn_lock.stat.exists
- not shrinkwrap.stat.exists
command: npm prune
environment:
DISPLAY: ':99'
args:
chdir: "{{ zuul_work_dir }}"
- name: Run npm shrinkwrap
when:
- not yarn_lock.stat.exists
- not shrinkwrap.stat.exists
command: npm shrinkwrap
environment:
DISPLAY: ':99'
args:
chdir: "{{ zuul_work_dir }}"
- name: Check for reports
stat:
path: "{{ zuul_work_dir }}/reports"
get_checksum: false
get_mime: false
register: reports_stat
- name: Collect npm reports
synchronize:
dest: "{{ log_path }}"
mode: pull
src: "{{ zuul_work_dir }}/reports"
verify_host: true
owner: no
group: no
when: reports_stat.stat.exists
- name: Check for karma.subunit files
stat:
path: "{{ zuul_work_dir }}/karma.subunit"
get_checksum: false
get_mime: false
register: karma_stat
- name: Collect karma subunit files
synchronize:
dest: "{{ log_path }}"
mode: pull
src: "{{ zuul_work_dir }}/karma.subunit"
verify_host: true
owner: no
group: no
when: karma_stat.stat.exists
- name: Check again for shrinkwrap
when: not yarn_lock.stat.exists
stat:
path: "{{ zuul_work_dir }}/npm-shrinkwrap.json"
get_checksum: false
get_mime: false
register: shrinkwrap_final
- name: Collect shrinkwrap file
synchronize:
dest: "{{ log_path }}"
mode: pull
src: "{{ zuul_work_dir }}/npm-shrinkwrap.json"
verify_host: true
owner: no
group: no
when:
- not yarn_lock.stat.exists
- shrinkwrap_final.stat.exists
- name: Check for built output
stat:
path: "{{ zuul_work_dir }}/{{ javascript_content_dir }}"
get_checksum: false
get_mime: false
register: javascript_output
- name: Collect javascript output
synchronize:
src: "{{ zuul_work_dir }}/{{ javascript_content_dir }}/"
dest: "{{ log_path }}/html/"
mode: pull
copy_links: "{{ javascript_copy_links }}"
verify_host: true
owner: no
group: no
when: javascript_output.stat.exists
- name: Check to see if coverage report exists
stat:
path: "{{ coverage_output_src }}"
register: coverage_report_stat
- name: Ensure cover tox dir
file:
path: "{{ cover_path }}"
state: directory
mode: 0755
delegate_to: localhost
when: coverage_report_stat.stat.exists
- name: Collect coverage details output
synchronize:
dest: "{{ cover_path }}"
mode: pull
src: "{{ coverage_output_src }}"
verify_host: true
owner: no
group: no
when: coverage_report_stat.stat.exists
- name: Return site artifact location to Zuul
zuul_return:
data:
zuul:
artifacts:
- name: "Site preview"
url: "npm/html/"
metadata:
type: site