web: use PUBLIC_URL instead of package.json patch

This change simplify dashboard run playbook to fix sub-url serving of
ci build.

Change-Id: I58db8958894f2b51cca03752d9913ca11df5bba4
This commit is contained in:
Tristan Cacqueray 2018-10-11 11:28:12 +00:00 committed by James E. Blair
parent be64ed2777
commit 04a15eeef7
2 changed files with 7 additions and 11 deletions

View File

@ -45,6 +45,7 @@
success-url: 'npm/html/'
files:
- web/.*
- playbooks/dashboard/.*
vars:
javascript_content_dir: "../zuul/web/static"
zuul_work_dir: "{{ zuul.project.src_dir }}/web"

View File

@ -1,15 +1,4 @@
- hosts: all
pre_tasks:
- name: Update homepage for sub directory deployment
replace:
path: '{{ zuul.project.src_dir }}/web/package.json'
regexp: '^{$'
replace: '{\n "homepage": "./",'
# NOTE: using "./" is not enough to support html5 links, even with
# rewrite rules for unknown files, accessing 'job/devstack' will make
# the dashboard load static files from 'job/static/...'
# This works for the preview dashboard that can only be loaded from the
# npm/html directory anyway.
roles:
- revoke-sudo
- set-zuul-log-path-fact
@ -17,3 +6,9 @@
npm_command: build
environment:
REACT_APP_ZUUL_API: "{{ zuul_api_url }}/api/"
PUBLIC_URL: './'
# NOTE: using "./" is not enough to support html5 links, even with
# rewrite rules for unknown files, accessing 'job/devstack' will make
# the dashboard load static files from 'job/static/...'
# This works for the preview dashboard that can only be loaded from the
# npm/html directory anyway.