Skip to content
This repository was archived by the owner on Jan 4, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion tools/zuul-projects-checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import re
import sys
import yaml

Expand Down Expand Up @@ -47,6 +48,39 @@ def check_projects_sorted():
return errors


def check_system_templates():
"""Check that each repo has a system-required template."""

errors = False
print("\nChecking for usage of system-required")
print("=====================================")
for entry in projects:
project = entry['project']
name = project['name']
# By default, projects under github.com/ansible-network have
# system-template applied
if re.match("^github.com/ansible-(network|security)/.*", name):
continue
# TODO(pabelanger): We need to make this more dynamic.
if re.match("^github.com/ansible/ansible", name):
continue
try:
correct = False
for template in project['templates']:
if template == 'system-required':
correct = True
if not correct:
raise
except Exception:
print("ERROR: Project %s has no system-required template" %
project['name'])
errors = True

if not errors:
print("... all fine.")
return errors


def check_release_jobs():
"""Minimal release job checks."""

Expand Down Expand Up @@ -172,7 +206,8 @@ def check_only_boilerplate():

def check_all():

errors = check_projects_sorted()
errors = check_system_templates()
errors = check_projects_sorted() or errors
errors = blacklist_jobs() or errors
errors = check_release_jobs() or errors
errors = check_voting() or errors
Expand Down