in main.py [0:0]
def alert_project(project: str, errors: dict):
"""Sends a notification to the project and infra aboot errors that were found"""
if errors:
if project not in PROJECTS_LIST: # Only notify for actual, existing projects
return
project_list = f"private@{project}.apache.org" # Standard naming
if project in MAIL_MAP:
project_list = f"private@{MAIL_MAP[project]['mail_list']}.apache.org" # Special case for certain committees
recipients = [project_list]
extra_recips = CFG.get("extra_recipients")
if isinstance(extra_recips, list):
recipients.extend(extra_recips)
errormsg = ""
for filepath, errorlines in errors.items():
errormsg += f" - Errors were found while verifying {filepath}:\n"
for errorline in errorlines:
errormsg += f" - {errorline}\n"
errormsg += "\n"
if "--debug" not in sys.argv: # Don't send emails if --debug is specified
print(f"Dispatching email to: {recipients}")
asfpy.messaging.mail(
sender="ASF Infrastructure <root@apache.org>",
subject=f"Verification of download artifacts on dist.apache.org FAILED for {project}!",
recipients=recipients,
message=EMAIL_TEMPLATE.format(**locals())
)
else:
print(errormsg)
sys.stdout.flush()