Merge "Update zuul-changes script for v3" into feature/zuulv3

This commit is contained in:
Monty Taylor 2017-09-29 23:12:34 +00:00 committed by Gerrit Code Review
commit 68d3ba566c
1 changed files with 7 additions and 5 deletions

View File

@ -20,14 +20,15 @@ import argparse
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('url', help='The URL of the running Zuul instance') parser.add_argument('url', help='The URL of the running Zuul instance')
parser.add_argument('pipeline_name', help='The name of the Zuul pipeline') parser.add_argument('tenant', help='The Zuul tenant')
parser.add_argument('pipeline', help='The name of the Zuul pipeline')
options = parser.parse_args() options = parser.parse_args()
data = urllib2.urlopen('%s/status.json' % options.url).read() data = urllib2.urlopen('%s/status.json' % options.url).read()
data = json.loads(data) data = json.loads(data)
for pipeline in data['pipelines']: for pipeline in data['pipelines']:
if pipeline['name'] != options.pipeline_name: if pipeline['name'] != options.pipeline:
continue continue
for queue in pipeline['change_queues']: for queue in pipeline['change_queues']:
for head in queue['heads']: for head in queue['heads']:
@ -36,9 +37,10 @@ for pipeline in data['pipelines']:
continue continue
cid, cps = change['id'].split(',') cid, cps = change['id'].split(',')
print( print(
"zuul enqueue --trigger gerrit --pipeline %s " "zuul enqueue --tenant %s --trigger gerrit "
"--project %s --change %s,%s" % ( "--pipeline %s --project %s --change %s,%s" % (
options.pipeline_name, options.tenant,
options.pipeline,
change['project'], change['project'],
cid, cps) cid, cps)
) )