builders-in-consoles.star 1.1 KB

12345678910111213141516171819202122232425262728
  1. # Copyright 2020 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. def _validate_builders_in_console(ctx):
  5. builders = {}
  6. for console in ctx.output["luci/luci-milo.cfg"].consoles:
  7. for builder in console.builders:
  8. _, long_bucket, builder_name = builder.name.split("/")
  9. _, _, bucket = long_bucket.split(".", 2)
  10. builders.setdefault(bucket, {})[builder_name] = True
  11. builders_without_console = []
  12. for bucket in ctx.output["luci/cr-buildbucket.cfg"].buckets:
  13. bucket_builders = builders.get(bucket.name, {})
  14. for builder in bucket.swarming.builders:
  15. if builder.name not in bucket_builders:
  16. builders_without_console.append(
  17. "{}/{}".format(bucket.name, builder.name),
  18. )
  19. if builders_without_console:
  20. fail("The following builders do not appear in any console:\n " +
  21. "\n ".join([repr(b) for b in builders_without_console]))
  22. lucicfg.generator(_validate_builders_in_console)