Add a Zuul job that builds and publishes the web dashboard
The job: - Sets the homepage in package.json to the URL where logs will be uploaded - Sets the API server in config.json to "api.demo.recordsansible.org" - Runs "npm run build" - Publishes the content to make it available during code review. Change-Id: I015bb4a177a5f8d3a34e4434dc11f6c37fc3ca15
This commit is contained in:
parent
06f906f570
commit
29041ab473
|
@ -0,0 +1,29 @@
|
|||
- job:
|
||||
name: ara-build-dashboard
|
||||
# https://zuul.openstack.org/job/build-javascript-content
|
||||
parent: build-javascript-content
|
||||
description: |
|
||||
Uses a Ubuntu Xenial VM with Node 8 to run "npm run build" and make the
|
||||
results available for browsing during code review on review.openstack.org.
|
||||
It sets the homepage parameter from package.json to the URL where logs will
|
||||
be uploaded and configures the API server to api.demo.recordsansible.org.
|
||||
success-url: 'npm/html/'
|
||||
files:
|
||||
- public/.*
|
||||
- src/.*
|
||||
- .zuul.yaml
|
||||
- zuul-playbooks/.*
|
||||
vars:
|
||||
node_version: 8
|
||||
npm_command: build
|
||||
javascript_content_dir: build
|
||||
pre-run: zuul-playbooks/pre.yaml
|
||||
run: zuul-playbooks/build-dashboard.yaml
|
||||
|
||||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- ara-build-dashboard
|
||||
gate:
|
||||
jobs:
|
||||
- ara-build-dashboard
|
|
@ -0,0 +1,8 @@
|
|||
zuul-playbooks
|
||||
==============
|
||||
|
||||
These playbooks are used for continuous integration jobs with Zuul_.
|
||||
|
||||
They are not meant to be used on their own.
|
||||
|
||||
.. _Zuul: https://zuul-ci.org
|
|
@ -0,0 +1,7 @@
|
|||
- name: Build ARA web dashboard with Zuul
|
||||
hosts: all
|
||||
roles:
|
||||
- revoke-sudo
|
||||
- set-zuul-log-path-fact
|
||||
- role: npm
|
||||
npm_command: build
|
|
@ -0,0 +1,39 @@
|
|||
- name: Set up package.json and config.json for CI with Zuul
|
||||
hosts: all
|
||||
vars:
|
||||
config:
|
||||
apiURL: "https://api.demo.recordsansible.org"
|
||||
project_dir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
|
||||
tasks:
|
||||
# Before building the application, we need to:
|
||||
# 1) Set the homepage argument from package.json to use the URL where logs will be uploaded.
|
||||
# 2) Set the API server in public/config.json to use api.demo.recordsansible.org
|
||||
- name: Resolve Zuul log path
|
||||
include_role:
|
||||
name: set-zuul-log-path-fact
|
||||
|
||||
- name: Read package.json
|
||||
command: "cat {{ project_dir }}/package.json"
|
||||
register: package_json
|
||||
|
||||
- name: Set homepage parameter
|
||||
vars:
|
||||
build_url: "http://logs.openstack.org/{{ zuul_log_path }}/npm/html/"
|
||||
set_fact:
|
||||
package_json: "{{ package_json.stdout | from_json | combine({'homepage': build_url}) }}"
|
||||
|
||||
- name: Write package.json
|
||||
copy:
|
||||
content: "{{ package_json | to_nice_json }}"
|
||||
dest: "{{ project_dir }}/package.json"
|
||||
|
||||
- name: Set config.json to use api.demo.recordsansible.org
|
||||
copy:
|
||||
content: "{{ config | to_nice_json }}"
|
||||
dest: "{{ project_dir }}/public/config.json"
|
||||
|
||||
- name: Read files for debug purposes
|
||||
command: "cat {{ item }}"
|
||||
loop:
|
||||
- "{{ project_dir }}/package.json"
|
||||
- "{{ project_dir }}/public/config.json"
|
Loading…
Reference in New Issue