Add scripts to generate tripleo.org website

See the included README.md for instructions on how to create
the website.

Change-Id: Ibbb57b1268fbf7623b1bffed8403e49b1ca10cbc
This commit is contained in:
Dan Prince 2016-04-01 08:42:55 -04:00
parent 20e91938fc
commit e517389092
4 changed files with 209 additions and 0 deletions

5
.gitignore vendored
View File

@ -3,3 +3,8 @@ tripleo-jobs.html
tripleo-jobs.html-table
*.swp
*~
scripts/website/out_html/
scripts/website/reviewday/
scripts/website/tripleo-ci/
scripts/website/tripleo-docs/
scripts/website/tripleosphinx/

40
scripts/website/README.md Normal file
View File

@ -0,0 +1,40 @@
tripleo.org
===========
Description
-----------
This directory contains scripts and config files used to generate the
tripleo.org website.
The following projects are used:
* tripleo-docs (our tripleo documentation)
* tripleosphinx (currently hosted on https://github.com/dprince/tripleosphinx.git)
* reviewday (provides an HTML report of reviews along with LP ticket priorities)
* tripleo-ci (HTML CI reports and other misc scripts.)
Building the site
-----------------
Tripleo.org is currently a static HTML website that is regenerated by scripts
or via a cron job.
To build the entire site run the following:
cd tripleo-ci/scripts/website
OUT\_HTML='out\_html' bash generate\_site.sh
NOTE: This will take some time to run reviewday (which makes remote Gerrit
and Lauchpad API connections) and generate the CI reports which contact
the API of the upstream Jenkins servers.
If you want to do a quick build to test out new HTML formatting, etc. you
can disable the reviewday and CI reports by running the following:
cd tripleo-ci/scripts/website
SKIP\_REVIEWDAY="Y" SKIP\_CI\_REPORTS="Y" OUT\_HTML='out\_html' bash generate\_site.sh
Once you executed either of the above commands the HTML website would be
in your local out\_html directory and can be viewed with any webrower
by pointing it to the local filesystem.

135
scripts/website/generate_site.sh Executable file
View File

@ -0,0 +1,135 @@
#!/bin/bash
# Copyright 2016 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
SCRIPT_DIR=${SCRIPT_DIR:-$(dirname $0)}
SUDO_CP=${SUDO_CP:-''} # useful if you'd like to inject a SUDO command for cp
OUT_HTML=${OUT_HTML:-'out_html'}
REVIEWDAY_INPUT_FILE="${SCRIPT_DIR}/tripleo-reviewday.yaml"
SKIP_REVIEWDAY=${SKIP_REVIEWDAY:-''}
SKIP_CI_REPORTS=${SKIP_CI_REPORTS:-''}
# TRIPLEO-DOCS
if [ ! -d tripleo-docs ]; then
git clone git://git.openstack.org/openstack/tripleo-docs
pushd tripleo-docs
tox -edocs #initial run
popd
else
pushd tripleo-docs
git reset --hard origin/master
git pull
popd
fi
# TRIPLEO SPHINX
if [ ! -d tripleosphinx ]; then
git clone https://github.com/dprince/tripleosphinx.git
pushd tripleosphinx
tox -edocs #creates the blank.html
popd
else
pushd tripleosphinx
git reset --hard origin/master
git pull
tox -edocs #creates the blank.html
popd
fi
# swap in custom tripleosphinx
pushd tripleo-docs
sed -e "s|oslosphinx|tripleosphinx|g" -i doc/source/conf.py
popd
#REVIEWDAY
if [ ! -d reviewday ]; then
git clone git://git.openstack.org/openstack-infra/reviewday
else
pushd reviewday
git reset --hard origin/master
git pull
popd
fi
#TRIPLEO CI
if [ ! -d tripleo-ci ]; then
git clone git://git.openstack.org/openstack-infra/tripleo-ci
else
pushd tripleo-ci
git reset --hard origin/master
git pull
popd
fi
#-----------------------------------------
source tripleo-docs/.tox/docs/bin/activate
pushd tripleosphinx
python setup.py install
popd
deactivate
pushd tripleo-docs
tox -edocs
popd
# Reviewday
if [ -z "$SKIP_REVIEWDAY" ]; then
pushd reviewday
tox -erun -- "-p $REVIEWDAY_INPUT_FILE"
cp -a arrow* out_report/*.png out_report/*.js out_report/*.css $OUT_HTML
DATA=$(cat out_report/data_table.html)
OUT_FILE=~/tripleo-docs/doc/build/html/reviews.html
TEMPLATE_FILE=~/tripleosphinx/doc/build/html/blank.html
sed -n '1,/.*Custom Content Here/p' $TEMPLATE_FILE > $OUT_FILE #first half
echo "<h1>TripleO Reviews</h1>" >> $OUT_FILE
sed -e "s|<title>.*|<title>TripleO: Reviews</title>|" -i $OUT_FILE # custom title
sed -e "s|<title>.*|<title>TripleO: Reviews</title><meta name='description' content='OpenStack Deployment Program Reviews'/>|" -i $OUT_FILE # custom title
echo $DATA >> $OUT_FILE
sed -n '/.*Custom Content Here/,$p' $TEMPLATE_FILE >> $OUT_FILE #second half
popd
fi
# TripleO CI
if [ -z "$SKIP_CI_REPORTS" ]; then
pushd tripleo-ci
# jobs report
tox -ecireport -- -f
DATA=$(cat tripleo-jobs.html-table)
OUT_FILE=~/tripleo-docs/doc/build/html/cistatus.html
TEMPLATE_FILE=~/tripleosphinx/doc/build/html/blank.html
sed -n '1,/.*Custom Content Here/p' $TEMPLATE_FILE > $OUT_FILE #first half
echo "<h1>TripleO CI Status</h1>" >> $OUT_FILE
sed -e "s|<title>.*|<title>TripleO: CI Status</title><meta name='description' content='OpenStack Deployment Program CI Status results'/>|" -i $OUT_FILE # custom title
echo $DATA >> $OUT_FILE
sed -n '/.*Custom Content Here/,$p' $TEMPLATE_FILE >> $OUT_FILE #second half
# periodic jobs report
tox -ecireport -- -f -d tripleo-periodic-jobs.db -o tripleo-periodic-jobs.html -j periodic-tripleo-ci-f22-nonha,periodic-tripleo-ci-f22-ha,periodic-tripleo-ci-f22-upgrades,periodic-tripleo-ci-f22-ha-liberty,periodic-tripleo-ci-f22-ha-mitaka
DATA=$(cat tripleo-periodic-jobs.html-table)
OUT_FILE=~/tripleo-docs/doc/build/html/cistatus-periodic.html
TEMPLATE_FILE=~/tripleosphinx/doc/build/html/blank.html
sed -n '1,/.*Custom Content Here/p' $TEMPLATE_FILE > $OUT_FILE #first half
echo "<h1>TripleO CI Periodic Status</h1>" >> $OUT_FILE
sed -e "s|<title>.*|<title>TripleO: CI Periodic Status</title><meta name='description' content='OpenStack Deployment Program CI Status periodic job results'/>|" -i $OUT_FILE # custom title
echo $DATA >> $OUT_FILE
sed -n '/.*Custom Content Here/,$p' $TEMPLATE_FILE >> $OUT_FILE #second half
popd
fi
# Copy in the new web pages
$SUDO_CP mkdir -p $OUT_HTML
$SUDO_CP cp -a $SCRIPT_DIR/tripleo-docs/doc/build/html/* $OUT_HTML

View File

@ -0,0 +1,29 @@
projects:
- name: dib-utils
launchpad_project: diskimage-builder
- name: diskimage-builder
- name: instack
launchpad_project: tripleo
- name: instack-undercloud
launchpad_project: tripleo
- name: os-apply-config
- name: os-cloud-config
- name: os-collect-config
- name: os-net-config
- name: os-refresh-config
- name: python-tripleoclient
launchpad_project: tripleo
- name: tripleo-common
launchpad_project: tripleo
- name: tripleo-docs
launchpad_project: tripleo
- name: tripleo-heat-templates
launchpad_project: tripleo
- name: tripleo-image-elements
launchpad_project: tripleo
- name: tripleo-incubator
launchpad_project: tripleo
- name: tripleo-puppet-elements
launchpad_project: tripleo
- name: tripleo-specs
launchpad_project: tripleo