blob: b7269c50eadcdc1b77a32665a8a481e97bc535fb [file] [log] [blame]
Mike Frysingere58c0e22017-10-04 15:43:30 -04001# -*- coding: utf-8 -*-
Dan Jacques2bcefd22015-05-18 14:57:00 -07002# Copyright 2015 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6"""Show the builder layout for CrOS waterfalls."""
7
8from __future__ import print_function
9
Aviv Keshetb7519e12016-10-04 00:50:00 -070010from chromite.lib import config_lib
Dan Jacques2bcefd22015-05-18 14:57:00 -070011from chromite.lib import commandline
12
13
Dan Jacques2bcefd22015-05-18 14:57:00 -070014def _ParseArguments(argv):
15 parser = commandline.ArgumentParser(description=__doc__)
16
Dan Jacques2bcefd22015-05-18 14:57:00 -070017 opts = parser.parse_args(argv)
Dan Jacques2bcefd22015-05-18 14:57:00 -070018 opts.Freeze()
19 return opts
20
21
Don Garrettd2a67112018-12-04 18:26:47 -080022def displayConfigs(label, configs):
23 print('== %s ==' % label)
24
25 for config in sorted(configs, key=lambda c: c.name):
26 print(' %s' % config.name)
27 if config.slave_configs:
28 for sc in sorted(config.slave_configs):
29 print(' %s' % sc)
30
31 print()
32
33
Dan Jacques2bcefd22015-05-18 14:57:00 -070034def main(argv):
Don Garrettd2a67112018-12-04 18:26:47 -080035 _ = _ParseArguments(argv)
Dan Jacques2bcefd22015-05-18 14:57:00 -070036
Don Garrett737cadd2015-10-22 17:43:47 -070037 site_config = config_lib.GetConfig()
Don Garrettb44956b2015-06-05 17:28:06 -070038
Don Garrettd2a67112018-12-04 18:26:47 -080039 # Organize the builds as:
40 # {Display Label: [build_config]}
Dan Jacques2bcefd22015-05-18 14:57:00 -070041
Don Garrettd2a67112018-12-04 18:26:47 -080042 labeled_builds = {}
43 for config in site_config.itervalues():
44 if config.schedule:
45 labeled_builds.setdefault(config.display_label, []).append(config)
Dan Jacques2bcefd22015-05-18 14:57:00 -070046
Don Garrettd2a67112018-12-04 18:26:47 -080047 for label in sorted(labeled_builds.iterkeys()):
48 displayConfigs(label, labeled_builds[label])
49
50 # Force the tryjob section to be last.
51 displayConfigs('tryjob',
52 [c for c in site_config.itervalues()
53 if config_lib.isTryjobConfig(c)])