
To make it easier to engage the liaisons, we have a tool that will add all current liaisons to an API WG review. Change-Id: I0c32aa407def04c8a81868ed8a682cb7888ff1ff
64 lines
1.6 KiB
Python
Executable File
64 lines
1.6 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import argparse
|
|
import json
|
|
import logging
|
|
import subprocess
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
def parse_args():
|
|
parser = argparse.ArgumentParser(
|
|
description="Add the cross-project liaisons as reviewers " \
|
|
"on an API working group review.")
|
|
parser.add_argument('--debug', help="Print debugging information",
|
|
action='store_true')
|
|
parser.add_argument("username", help="Your Gerrit username", type=str)
|
|
parser.add_argument("review", help="An API WG Gerrit review", type=int)
|
|
args = parser.parse_args()
|
|
|
|
return (args.debug, args.username, args.review)
|
|
|
|
def get_liaisons():
|
|
with open('doc/source/liaisons.json') as f:
|
|
liaisons = json.load(f)['liaisons']
|
|
|
|
names = [liaison['name'] for liaison in liaisons if liaison['name']]
|
|
|
|
return names
|
|
|
|
def add_reviewers(debug, username, liaisons, review):
|
|
gerrit = [
|
|
'ssh',
|
|
'-p',
|
|
'29418',
|
|
'{}@review.openstack.org'.format(username),
|
|
'gerrit',
|
|
'set-reviewers'
|
|
]
|
|
|
|
for liaison in liaisons:
|
|
gerrit.append('--add "{}"'.format(liaison))
|
|
|
|
gerrit.append('{}'.format(review))
|
|
|
|
logger.debug(' '.join(gerrit))
|
|
|
|
subprocess.call(gerrit)
|
|
|
|
if __name__ == '__main__':
|
|
debug, username, review = parse_args()
|
|
|
|
level = logging.INFO
|
|
if debug:
|
|
level = logging.DEBUG
|
|
|
|
logging.basicConfig(
|
|
level=level,
|
|
format='%(levelname)s: %(message)s')
|
|
|
|
liaisons = get_liaisons()
|
|
add_reviewers(debug, username, liaisons, review)
|
|
|
|
print("Added {} reviewers to {}".format(len(liaisons), review))
|