Automate review inbox dashboard link
We have gerrit-dash-creator and https://tiny.cc/ReleaseInbox, but both require manual steps to be taken by someone each time the status of a series changes. Since we already capture series status data in a format that is easily parsable, let's just add a sphinx directive to make this automatic. Change-Id: I05b2a65b52809d249bfb299164d624f6de5bff02 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
parent
710adef48d
commit
f4566fb27d
95
doc/source/_exts/reviewinbox.py
Normal file
95
doc/source/_exts/reviewinbox.py
Normal file
@ -0,0 +1,95 @@
|
||||
# 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.
|
||||
|
||||
from docutils import nodes
|
||||
from docutils.parsers import rst
|
||||
from docutils import statemachine as sm
|
||||
from urllib import parse as urllib_parse
|
||||
|
||||
from openstack_releases import series_status
|
||||
|
||||
QUERY_TEMPLATE = ('project:openstack/releases file:^deliverables/{}/.* '
|
||||
'NOT label:Workflow-1')
|
||||
|
||||
|
||||
# Leveraging a couple pieces from gerrit-dash-creator so we don't have to pull
|
||||
# in the full project.
|
||||
def escape(buff):
|
||||
"""Because otherwise Firefox is a sad panda."""
|
||||
return buff.replace(',', '%2c').replace('-', '%2D')
|
||||
|
||||
|
||||
class ReviewInbox(rst.Directive):
|
||||
"""Directive for generating review inbox based on current series status."""
|
||||
|
||||
has_content = True
|
||||
|
||||
def run(self):
|
||||
url = 'https://review.opendev.org/#/dashboard/?'
|
||||
sections = []
|
||||
|
||||
url += escape(urllib_parse.urlencode({
|
||||
'title': 'Releases Inbox',
|
||||
'foreach': 'is:open'})) + '&'
|
||||
|
||||
# Add the series specific data based on its current status
|
||||
series_status_data = series_status.SeriesStatus.default()
|
||||
for series_name in series_status_data:
|
||||
series = series_status_data[series_name]
|
||||
if series.status not in ['development', 'maintained']:
|
||||
continue
|
||||
|
||||
if series_name == 'independent':
|
||||
series_name = '_independent'
|
||||
sections.append(escape(urllib_parse.urlencode({
|
||||
series.name.title(): QUERY_TEMPLATE.format(series_name)})))
|
||||
|
||||
# Now add our sections that never change
|
||||
sections.append(escape(urllib_parse.urlencode({
|
||||
'Other':
|
||||
r'project:openstack/releases NOT file:^deliverables/.*'})))
|
||||
|
||||
sections.append(escape(urllib_parse.urlencode({
|
||||
'Jobs':
|
||||
r'project:openstack/project-config file:^roles/'
|
||||
r'copy-release-tools-scripts/files/release-tools/.*'})))
|
||||
|
||||
sections.append(escape(urllib_parse.urlencode({
|
||||
'Tools':
|
||||
r'(( project:openstack/releases file:^tools/.* ) OR '
|
||||
r'project:openstack/release-test OR '
|
||||
r'( project:openstack/releases file:^openstack_releases/.* ) OR '
|
||||
r'project:openstack/reno)'})))
|
||||
|
||||
sections.append(escape(urllib_parse.urlencode({
|
||||
'All Releases': 'is:open project:openstack/releases'})))
|
||||
|
||||
url += '&'.join(sections)
|
||||
|
||||
result = sm.ViewList()
|
||||
source = '<{}>'.format(__name__)
|
||||
|
||||
result.append('`Gerrit Release Review Inbox <{}>`_'.format(
|
||||
url), source)
|
||||
|
||||
node = nodes.section()
|
||||
node.document = self.state.document
|
||||
self.state.nested_parse(result, 0, node)
|
||||
return node.children
|
||||
|
||||
|
||||
def setup(app):
|
||||
app.add_directive('reviewinbox', ReviewInbox)
|
||||
return {
|
||||
'parallel_read_safe': True,
|
||||
'parallel_write_safe': True,
|
||||
}
|
@ -21,6 +21,7 @@ extensions = [
|
||||
'deliverables',
|
||||
'sphinxcontrib.datatemplates',
|
||||
'ics',
|
||||
'reviewinbox',
|
||||
]
|
||||
|
||||
config_generator_config_file = 'config-generator.conf'
|
||||
|
@ -2,6 +2,11 @@
|
||||
Reviewer Guide
|
||||
================
|
||||
|
||||
Review Inbox
|
||||
============
|
||||
|
||||
.. reviewinbox::
|
||||
|
||||
General Review Considerations
|
||||
=============================
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user