Generate specs.o.o root page from template

Use a YAML file listing the projects to generate the specs.openstack.org
root page and an OPML file for all of the available RSS feeds.

These changes are based on the work of Maish Saidel-Keesing
<maishsk@gmail.com> in https://review.openstack.org/#/c/140041/

Change-Id: I828d65f10fb7608b59e3561cedc9553d4d96ee75
This commit is contained in:
Doug Hellmann 2014-12-11 16:22:48 -05:00
parent 2c7d982f58
commit b332c2a776
9 changed files with 193 additions and 131 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
/.project
/.pydevproject
*.egg
specs/output

View File

@ -2034,6 +2034,7 @@
jobs:
- gate-{name}-pep8
- gate-{name}-bashate
- generate-specs-site-jobs
- project:
name: puppet-github

View File

@ -32,3 +32,45 @@
- gate-{name}-docs
- gate-{name}-python27
- '{name}-publish-specs'
- builder:
name: generate-specs-site
builders:
- revoke-sudo
- gerrit-git-prep
- tox:
envlist: specs
- job:
name: check-generate-specs-site
description: Render the specs sites templates without publishing them.
node: 'bare-precise || bare-trusty'
builders:
- generate-specs-site
- job:
name: publish-specs-site
description: Render the specs sites templates and publish them.
node: 'bare-precise || bare-trusty'
builders:
- generate-specs-site
publishers:
- scp:
site: 'static.openstack.org'
files:
- target: 'specs/'
source: '$ZUUL_PROJECT/specs/output/**'
keep-hierarchy: true
copy-after-failure: false
- console-log
- job-group:
name: generate-specs-site-jobs
jobs:
- check-generate-specs-site
- publish-specs-site

65
specs/generate_specs_site.py Executable file
View File

@ -0,0 +1,65 @@
#!/usr/bin/env python
#
# 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.
"""Read the specs.yaml file and generate the index.html and specs.opml files.
"""
from __future__ import print_function
import argparse
import os
import jinja2
import yaml
def render_template(template_filename, output_filename, template_context):
with open(template_filename, 'r') as f:
template = jinja2.Template(f.read())
print('Writing %r' % output_filename)
with open(output_filename, 'w') as f:
f.write(template.render(**template_context))
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--verbose',
dest='verbose',
default=False,
action='store_true',
)
parser.add_argument(
'infile',
help='Path to specs/specs.yaml',
)
args = parser.parse_args()
print('Reading project data from %r' % args.infile)
infile = yaml.load(open(args.infile, 'r'))
template_path = os.path.dirname(args.infile)
template_context = {
'projects': infile['projects'],
'programs': infile['programs'],
'all': infile['projects'] + infile['programs'],
}
outdir = os.path.join(template_path, 'output')
if not os.path.exists(outdir):
os.makedirs(outdir)
for template_name, filename in [('index.html.tmpl', 'index.html'),
('specs.opml.tmpl', 'specs.opml')]:
render_template(os.path.join(template_path, template_name),
os.path.join(outdir, filename),
template_context)

View File

@ -113,102 +113,14 @@
<!-- This lists follows the naming of
http://docs.openstack.org/developer/openstack-projects.html -->
<dl>
{% for project in projects %}
<dd>
<a href="openstack/ironic-specs">
Bare Metal Provisioning Specifications (ironic)
<a href="{{project.repo}}">
{{project.name}}
</a>
(<a href="openstack/ironic-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/nova-specs/">
Compute Service
Specifications (nova)
</a>
(<a href="openstack/nova-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/sahara-specs/">
Data Processing Service
Specifications (sahara)
</a>
(<a href="openstack/sahara-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/trove-specs/">
Database Service Specifications (trove)
</a>
(<a href="openstack/trove-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/designate-specs/">
DNS Services
Specifications (designate)
</a>
(<a href="openstack/designate-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/keystone-specs/">
Identity Program
Specifications (keystone)
</a>
(<a href="openstack/keystone-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/glance-specs/">
Image Service
Specifications (glance)
</a>
(<a href="openstack/glance-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/barbican-specs/">
Key Management Service
Specifications (barbican)
</a>
(<a href="openstack/barbican-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/neutron-specs/">
Networking Service
Developer Specifications (neutron)
</a>
(<a href="openstack/neutron-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/swift-specs/">
Object Storage
Specifications (swift)
</a>
(<a href="openstack/swift-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/heat-specs/">
Orchestration
Specifications (heat)
</a>
(<a href="openstack/heat-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/zaqar-specs/">
Queue Service
Specifications (zaqar)
</a>
(<a href="openstack/zaqar-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/ceilometer-specs/">
Telemetry Service
Specifications (ceilometer)
</a>
(<a href="openstack/ceilometer-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/cinder-specs/">
Volume Service
Specifications (cinder)
</a>
(<a href="openstack/cinder-specs/rss.xml">RSS</a>)
(<a href="{{project.repo}}/rss.xml">RSS</a>)
</dd>
{% endfor %}
</dl>
</div>
<div class="span-12 last-right" id="subnav-right">
@ -220,50 +132,20 @@
</li>
</ul>
<dl>
{% for project in programs %}
<dd>
<a href="openstack/api-wg/">
API Working Group
Guidelines
<a href="{{project.repo}}">
{{project.name}}
</a>
(<a href="{{project.repo}}/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/oslo-specs/">
Common Libraries Program
Specifications (oslo)
</a>
(<a href="openstack/oslo-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/tripleo-specs/">
Deployment Program
Specifications
</a>
(<a href="openstack/tripleo-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/docs-specs/">
Documentation Program
Specifications
</a>
(<a href="openstack/docs-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack-infra/infra-specs/">
Infrastructure Program
Specifications
</a>
(<a href="openstack-infra/infra-specs/rss.xml">RSS</a>)
</dd>
<dd>
<a href="openstack/qa-specs/">
QA Program
Specifications
</a>
(<a href="openstack/qa-specs/rss.xml">RSS</a>)
</dd>
{% endfor %}
</dl>
</div>
</div>
<div class="span-12">
<a href="specs.opml">OPML file with all RSS feeds</a>
</div>
</div>
<!-- Page Content -->
<script type="text/javascript">

19
specs/specs.opml.tmpl Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>OpenStack Specs Feeds</title>
</head>
<body>
<outline text="OpenStack Specs" title="OpenStack Specs">
{% for project in all %}
<outline type="rss"
text="{{project.name}}"
title="{{project.name}}"
xmlUrl="http://specs.openstack.org/{{project.repo}}/rss.xml"
htmlUrl="http://specs.openstack.org/{{project.repo}}">
</outline>
{% endfor %}
</outline>
</body>
</opml>

42
specs/specs.yaml Normal file
View File

@ -0,0 +1,42 @@
projects:
- name: Bare Metal Provisioning Specifications (ironic)
repo: openstack/ironic-specs
- name: Compute Service Specifications (nova)
repo: openstack/nova-specs
- name: Data Processing Service Specifications (sahara)
repo: openstack/sahara-specs
- name: Database Service Specifications (trove)
repo: openstack/trove-specs
- name: DNS Services Specifications (designate)
repo: openstack/designate-specs
- name: Identity Program Specifications (keystone)
repo: openstack/keystone-specs
- name: Image Service Specifications (glance)
repo: openstack/glance-specs
- name: Key Management Service Specifications (barbican)
repo: openstack/barbican-specs
- name: Networking Service Developer Specifications (neutron)
repo: openstack/neutron-specs
- name: Object Storage Specifications (swift)
repo: openstack/swift-specs
- name: Orchestration Specifications (heat)
repo: openstack/heat-specs
- name: Queue Service Specifications (zaqar)
repo: openstack/zaqar-specs
- name: Telemetry Service Specifications (ceilometer)
repo: openstack/ceilometer-specs
- name: Volume Service Specifications (cinder)
repo: openstack/cinder-specs
programs:
- name: API Working Group Guidelines
repo: openstack/api-wg
- name: Common Libraries Program Specifications (oslo)
repo: openstack/oslo-specs
- name: Deployment Program Specifications
repo: openstack/tripleo-specs
- name: Documentation Program Specifications
repo: openstack/docs-specs
- name: Infrastructure Program Specifications
repo: openstack/infra-specs
- name: QA Program Specifications
repo: openstack/qa-specs

View File

@ -58,3 +58,9 @@ commands =
[testenv:bashate]
commands = {toxinidir}/tools/run-bashate.sh
[testenv:specs]
deps =
Jinja2
PyYAML
commands = {toxinidir}/specs/generate_specs_site.py {toxinidir}/specs/specs.yaml

View File

@ -3374,6 +3374,7 @@ projects:
- gate-project-config-irc-access
- gate-project-config-jenkins-project
- gate-project-config-projects-yaml
- check-generate-specs-site
gate:
- gate-project-config-layout
- gate-project-config-pep8
@ -3381,6 +3382,9 @@ projects:
- gate-project-config-irc-access
- gate-project-config-jenkins-project
- gate-project-config-projects-yaml
- check-generate-specs-site
post:
- publish-specs-site
- name: openstack-infra/publications
template: