ara/tests/role-ara-web-post.yaml
David Moreau Simard 064b87b54f
Import role for deploying ara-web
The ara_web role is intended as a way to deploy and install the
ara-web project in different ways.

The commit also adds integration test jobs for the role.
The integration job names and general layout will be cleaned up
in a future patch.

Change-Id: Ib59c455bb38f107fef3d5aca3dff42b6f7eac8a7
2019-03-08 17:16:39 -05:00

47 lines
1.5 KiB
YAML

- name: Deploy ara-web
hosts: all
gather_facts: yes
vars:
ara_web_source_checkout: "{{ ansible_user_dir }}/.ara/git/ara-web"
config:
apiURL: "https://api.demo.recordsansible.org"
tasks:
# Before building the application, we need to set the homepage argument
# from package.json to use the URL where logs will be uploaded.
- name: Resolve Zuul log path
include_role:
name: set-zuul-log-path-fact
- name: Read package.json
command: "cat {{ ara_web_source_checkout }}/package.json"
register: package_json
- name: Set homepage parameter
vars:
build_url: "http://logs.openstack.org/{{ zuul_log_path }}/build"
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: "{{ ara_web_source_checkout }}/package.json"
- name: Set config.json to use api.demo.recordsansible.org
copy:
content: "{{ config | to_nice_json }}"
dest: "{{ ara_web_source_checkout }}/public/config.json"
- name: Run a production build of ara-web
command: npm run build
args:
chdir: "{{ ara_web_source_checkout }}"
creates: "{{ ara_web_source_checkout }}/build"
- name: Upload build to log server
synchronize:
src: "{{ ara_web_source_checkout }}/build"
dest: "{{ zuul.executor.log_root }}"
mode: pull
verify_host: true