From 7caeb6062335050016b4f97013c3e1436610037a Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Sat, 4 Aug 2018 16:14:58 +0200 Subject: [PATCH] Check for empty project entries Check that no entries are added to zuul/projects.yaml that only contain the project name but do not configure any jobs. These are redundant, let's remove them. Change-Id: I048c9011038a38fee4694defc012762079065ce5 --- tools/zuul-projects-checks.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tools/zuul-projects-checks.py b/tools/zuul-projects-checks.py index 485b79e241..13891e5338 100755 --- a/tools/zuul-projects-checks.py +++ b/tools/zuul-projects-checks.py @@ -165,12 +165,36 @@ def check_voting(): return errors +def check_only_boilerplate(): + """Check for redundant boilerplate with not jobs.""" + + errors = False + print("\nChecking that every project has entries") + print("======================") + for entry in projects: + project = entry['project'] + if len(project.keys()) <= 1: + name = project['name'] + errors = True + print(" Found project %s with no jobs configured." % name) + + if errors: + print("Errors found!\n") + print("Do not add projects with only names entry but no jobs,") + print("remove the entry completely - unless you forgot to add jobs.") + else: + print("... all fine.") + + return errors + + def check_all(): errors = check_projects_sorted() errors = blacklist_jobs() or errors errors = check_release_jobs() or errors errors = check_voting() or errors + errors = check_only_boilerplate() or errors if errors: print("\nFound errors in zuul.d/projects.yaml!\n")