blob: 46f8667601721ea4bffb65db622f78303df7ee95 [file] [log] [blame]
Mike Frysingerf1ba7ad2022-09-12 05:42:57 -04001# Copyright 2015 The ChromiumOS Authors
Dan Jacques2bcefd22015-05-18 14:57:00 -07002# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""Show the builder layout for CrOS waterfalls."""
6
Dan Jacques2bcefd22015-05-18 14:57:00 -07007from chromite.lib import commandline
Mike Frysinger807d8282022-04-28 22:45:17 -04008from chromite.lib import config_lib
Dan Jacques2bcefd22015-05-18 14:57:00 -07009
10
Dan Jacques2bcefd22015-05-18 14:57:00 -070011def _ParseArguments(argv):
Alex Klein1699fab2022-09-08 08:46:06 -060012 parser = commandline.ArgumentParser(description=__doc__)
Dan Jacques2bcefd22015-05-18 14:57:00 -070013
Alex Klein1699fab2022-09-08 08:46:06 -060014 opts = parser.parse_args(argv)
15 opts.Freeze()
16 return opts
Dan Jacques2bcefd22015-05-18 14:57:00 -070017
18
Don Garrettd2a67112018-12-04 18:26:47 -080019def displayConfigs(label, configs):
Alex Klein1699fab2022-09-08 08:46:06 -060020 print("== %s ==" % label)
Don Garrettd2a67112018-12-04 18:26:47 -080021
Alex Klein1699fab2022-09-08 08:46:06 -060022 for config in sorted(configs, key=lambda c: c.name):
23 print(" %s" % config.name)
24 if config.slave_configs:
25 for sc in sorted(config.slave_configs):
26 print(" %s" % sc)
Don Garrettd2a67112018-12-04 18:26:47 -080027
Alex Klein1699fab2022-09-08 08:46:06 -060028 print()
Don Garrettd2a67112018-12-04 18:26:47 -080029
30
Dan Jacques2bcefd22015-05-18 14:57:00 -070031def main(argv):
Alex Klein1699fab2022-09-08 08:46:06 -060032 _ = _ParseArguments(argv)
Dan Jacques2bcefd22015-05-18 14:57:00 -070033
Alex Klein1699fab2022-09-08 08:46:06 -060034 site_config = config_lib.GetConfig()
Don Garrettb44956b2015-06-05 17:28:06 -070035
Alex Klein1699fab2022-09-08 08:46:06 -060036 # Organize the builds as:
37 # {Display Label: [build_config]}
Dan Jacques2bcefd22015-05-18 14:57:00 -070038
Alex Klein1699fab2022-09-08 08:46:06 -060039 labeled_builds = {}
40 for config in site_config.values():
41 if config.schedule:
42 labeled_builds.setdefault(config.display_label, []).append(config)
Dan Jacques2bcefd22015-05-18 14:57:00 -070043
Alex Klein1699fab2022-09-08 08:46:06 -060044 for label in sorted(labeled_builds.keys()):
45 displayConfigs(label, labeled_builds[label])
Don Garrettd2a67112018-12-04 18:26:47 -080046
Alex Klein1699fab2022-09-08 08:46:06 -060047 # Force the tryjob section to be last.
48 displayConfigs(
49 "tryjob",
50 [c for c in site_config.values() if config_lib.isTryjobConfig(c)],
51 )