The Gatekeeper, or a project gating system
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.4 KiB

#!/usr/bin/env python
# Copyright 2013 OpenStack Foundation
# 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
# 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.
# This script can be used to manually trigger a job in the same way that
# Zuul does. At the moment, it only supports the post set of Zuul
# parameters.
import argparse
import time
import json
from uuid import uuid4
import gear
def main():
c = gear.Client()
parser = argparse.ArgumentParser(description='Trigger a Zuul job.')
parser.add_argument('--job', dest='job', required=True,
help='Job Name')
parser.add_argument('--project', dest='project', required=True,
help='Project name')
parser.add_argument('--pipeline', dest='pipeline', default='release',
help='Zuul pipeline')
parser.add_argument('--refname', dest='refname',
help='Ref name')
parser.add_argument('--oldrev', dest='oldrev',
help='Old revision (SHA)')
parser.add_argument('--newrev', dest='newrev',
help='New revision (SHA)')
args = parser.parse_args()
data = {'ZUUL_PIPELINE': args.pipeline,
'ZUUL_PROJECT': args.project,
'ZUUL_UUID': str(uuid4().hex),
'ZUUL_REF': args.refname,
'ZUUL_REFNAME': args.refname,
'ZUUL_OLDREV': args.oldrev,
'ZUUL_NEWREV': args.newrev,
'ZUUL_SHORT_OLDREV': args.oldrev[:7],
'ZUUL_SHORT_NEWREV': args.newrev[:7],
'ZUUL_COMMIT': args.newrev,
c.addServer('', 4730)
job = gear.Job("build:%s" % args.job,
while not job.complete:
if __name__ == '__main__':