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
This commit is contained in:
Andreas Jaeger 2018-08-04 16:14:58 +02:00
parent 820806b88e
commit 7caeb60623

View File

@ -165,12 +165,36 @@ def check_voting():
return errors 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(): def check_all():
errors = check_projects_sorted() errors = check_projects_sorted()
errors = blacklist_jobs() or errors errors = blacklist_jobs() or errors
errors = check_release_jobs() or errors errors = check_release_jobs() or errors
errors = check_voting() or errors errors = check_voting() or errors
errors = check_only_boilerplate() or errors
if errors: if errors:
print("\nFound errors in zuul.d/projects.yaml!\n") print("\nFound errors in zuul.d/projects.yaml!\n")