Skip to content
Snippets Groups Projects
Verified Commit 34be7c8d authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

Include environment name in notification email subject line

parent 292ec56b
No related branches found
No related tags found
1 merge request!246Include environment name in notification email subject line
Pipeline #88286 passed
...@@ -18,10 +18,10 @@ def gather_failed_tasks() -> State: ...@@ -18,10 +18,10 @@ def gather_failed_tasks() -> State:
@step("Send notification emails for all failed tasks") @step("Send notification emails for all failed tasks")
def send_email_notifications(state: State) -> None: def send_email_notifications(state: State) -> None:
"""Send out an email notification for all tasks that have failed.""" """Send out an email notification for all tasks that have failed."""
base_url = load_oss_params().GENERAL.public_hostname general_settings = load_oss_params().GENERAL
all_alerts = "" all_alerts = ""
for failure in state["failed_tasks"]: for failure in state["failed_tasks"]:
failed_task_url = f"{base_url}/workflows/{failure["process_id"]}" failed_task_url = f"{general_settings.public_hostname}/workflows/{failure["process_id"]}"
failed_subscription = get_subscription_by_process_id(failure["process_id"]) failed_subscription = get_subscription_by_process_id(failure["process_id"])
all_alerts = f"{all_alerts}------\n\n" all_alerts = f"{all_alerts}------\n\n"
if failed_subscription: if failed_subscription:
...@@ -36,7 +36,7 @@ def send_email_notifications(state: State) -> None: ...@@ -36,7 +36,7 @@ def send_email_notifications(state: State) -> None:
) )
send_mail( send_mail(
"GAP - One or more tasks have failed!", f"GAP {general_settings.environment} environment - One or more tasks have failed!",
( (
f"Please check the following tasks in GAP which have failed.\n\n{all_alerts}------" f"Please check the following tasks in GAP which have failed.\n\n{all_alerts}------"
f"\n\nRegards, the GÉANT Automation Platform.\n\n" f"\n\nRegards, the GÉANT Automation Platform.\n\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment