def main(): project = project_pb2.Project() with open(os.path.join(THIS_DIR, 'luci-milo.cfg'), 'rb') as f: google.protobuf.text_format.Parse(f.read(), project) # Maps subwaterfall name to list of builders on that subwaterfall # on the main waterfall. subwaterfalls = collections.defaultdict(list) for console in project.consoles: if console.id == 'main': # Chromium main waterfall console. for builder in console.builders: subwaterfall = builder.category.split('|', 1)[0] subwaterfalls[subwaterfall].append(builder) # subwaterfalls contains the waterfalls referenced by the main console # Check that every referenced subwaterfall has its own console. all_console_names = set([console.id for console in project.consoles]) referenced_names = set(subwaterfalls.keys()) missing_names = referenced_names - all_console_names if missing_names: print 'Missing subwaterfall console for', missing_names return 1 # Check that the bots on a subwaterfall match the corresponding bots on the # main waterfall all_good = True for console in project.consoles: if console.id in subwaterfalls: if not compare_builders(console.id, subwaterfalls[console.id], console.builders): all_good = False return 0 if all_good else 1
def main(): project = project_pb2.Project() with open(os.path.join(THIS_DIR, 'luci-milo.cfg'), 'rb') as f: google.protobuf.text_format.Parse(f.read(), project) # Maps subwaterfall name to list of builders on that subwaterfall # on the main waterfall. subwaterfalls = collections.defaultdict(list) for console in project.consoles: if console.id == 'main': # Chromium main waterfall console. for builder in console.builders: subwaterfall = builder.category.split('|', 1)[0] subwaterfalls[subwaterfall].append(builder) all_good = True for console in project.consoles: if console.id in subwaterfalls: if not compare_builders(console.id, subwaterfalls[console.id], console.builders): all_good = False return 0 if all_good else 1