Fetch built web content in javascript jobs

If a javascript job produces web content that should be deployed (such
as zuul-web or storyboard-webclient) we should collect that in the post
step of the job and put it into the html/ directory.

While in there, add a bunch of get_*: false entries for the stat calls.
Calculating the md5 and whatnot is expensive, and we should really
always set them to false unless we're *using* the hash values.

Change-Id: I9b96656aa5f225e4b069a78442cf0159cadc9009
This commit is contained in:
Monty Taylor 2017-12-16 10:09:46 -06:00
parent 8a86f7c7fc
commit 89f68c5ca0
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
4 changed files with 91 additions and 3 deletions

View File

@ -1,4 +1,4 @@
Collect logs from a javascript build
Collect outputs from a javascript build
**Role Variables**
@ -6,3 +6,9 @@ Collect logs from a javascript build
:default: {{ zuul.project.src_dir }}
Directory to work in
.. zuul:rolevar:: javascript_content_dir
:default: dist
Directory, relative to zuul_work_dir, in which javascript output content
is to be found.

View File

@ -1 +1,2 @@
zuul_work_dir: "{{ zuul.project.src_dir }}"
javascript_content_dir: dist

View File

@ -17,11 +17,17 @@
- name: Check for yarn.lock
stat:
path: "{{ zuul_work_dir }}/yarn.lock"
get_checksum: false
get_mime: false
get_md5: false
register: yarn_lock
- name: Check for shrinkwrap
stat:
path: "{{ zuul_work_dir }}/npm-shrinkwrap.json"
get_checksum: false
get_mime: false
get_md5: false
when: not yarn_lock.stat.exists
register: shrinkwrap
@ -48,6 +54,9 @@
- name: Check for reports
stat:
path: "{{ zuul_work_dir }}/reports"
get_checksum: false
get_mime: false
get_md5: false
register: reports_stat
- name: Collect npm reports
@ -61,6 +70,9 @@
- name: Check for karma.subunit files
stat:
path: "{{ zuul_work_dir }}/karma.subunit"
get_checksum: false
get_mime: false
get_md5: false
register: karma_stat
- name: Collect karma subunit files
@ -75,6 +87,9 @@
when: not yarn_lock.stat.exists
stat:
path: "{{ zuul_work_dir }}/npm-shrinkwrap.json"
get_checksum: false
get_mime: false
get_md5: false
register: shrinkwrap_final
- name: Collect shrinkwrap file
@ -86,3 +101,20 @@
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
get_md5: false
register: javascript_output
- name: Collect javascript output
synchronize:
src: "{{ zuul_work_dir }}/{{ javascript_content_dir }}/"
dest: "{{ log_path }}/html/"
mode: pull
copy_links: true
verify_host: true
when: javascript_output.stat.exists

View File

@ -243,7 +243,7 @@
Responds to these variables:
.. zuul:jobvar:: npm_command
:default: test
:default: build
Command to pass to npm.
@ -256,11 +256,16 @@
:default: {{ zuul.project.src_dir }}
Path to operate in.
.. zuul:jobvar: javascript_content_dir
:default: dist
Directory, relative to zuul_work_dir, holding build content.
pre-run: playbooks/javascript/pre.yaml
run: playbooks/javascript/run.yaml
post-run: playbooks/javascript/post.yaml
vars:
npm_command: test
npm_command: build
- job:
name: build-javascript-tarball
@ -279,9 +284,43 @@
:default: {{ zuul.project.src_dir }}
Path to operate in.
.. zuul:jobvar: javascript_content_dir
:default: dist
Directory, relative to zuul_work_dir, holding build content.
vars:
npm_command: pack
- job:
name: build-javascript-content
parent: nodejs-npm
description: |
Build javascript web content as it should be deployed.
Responds to these variables:
.. zuul:jobvar:: npm_command
:default: build
Command to pass to npm.
.. zuul:jobvar:: node_version
:default: 6
The version of Node to use.
.. zuul:jobvar: zuul_work_dir
:default: {{ zuul.project.src_dir }}
Path to operate in.
.. zuul:jobvar: javascript_content_dir
:default: dist
Directory, relative to zuul_work_dir, holding build content.
success-url: html/
- job:
name: nodejs-npm-run-test
description: |
@ -299,6 +338,11 @@
:default: {{ zuul.project.src_dir }}
Path to operate in.
.. zuul:jobvar: javascript_content_dir
:default: dist
Directory, relative to zuul_work_dir, holding build content.
pre-run: playbooks/javascript/pre-test.yaml
run: playbooks/javascript/run.yaml
post-run: playbooks/javascript/post.yaml
@ -322,6 +366,11 @@
:default: {{ zuul.project.src_dir }}
Path to operate in.
.. zuul:jobvar: javascript_content_dir
:default: dist
Directory, relative to zuul_work_dir, holding build content.
vars:
npm_command: lint