Add triggerword support for completed runs
This commit is contained in:
parent
00dd050151
commit
8201535b5b
|
@ -106,6 +106,9 @@ pvc:
|
|||
success: "✅" # A task succeeded
|
||||
failure: "❌" # A task failed
|
||||
completed: "👌" # A task is completed
|
||||
# A trigger word (no whitespace) added to the end of the completed cluster message; this can be used
|
||||
# for pings in various chat systems (e.g. Mattermost)
|
||||
completed_triggerword: "#pvcbootstrapcompleted"
|
||||
# The webhook body elements; this is specific to the webhook target, and is converted into raw
|
||||
# JSON before sending.
|
||||
# Two special variables are used: "{icon}" displays one of the above icons, and "{message}" displays
|
||||
|
|
|
@ -35,6 +35,7 @@ pvc:
|
|||
enabled: false
|
||||
uri: https://mattermost.domain.tld/hooks/asecretstring
|
||||
action: post
|
||||
completed_triggerword: "#pvcbootstrapcompleted"
|
||||
icons:
|
||||
info: "❕" # A note about an event
|
||||
begin: "🤞" # A task is beginning
|
||||
|
|
|
@ -205,7 +205,7 @@ def read_config():
|
|||
)
|
||||
|
||||
# Get the Notifications configuration
|
||||
for key in ["enabled", "uri", "action", "icons", "body"]:
|
||||
for key in ["enabled", "uri", "action", "icons", "body", "completed_triggerword"]:
|
||||
try:
|
||||
config[f"notifications_{key}"] = o_notifications[key]
|
||||
except Exception:
|
||||
|
|
|
@ -38,6 +38,9 @@ def send_webhook(config, status, message):
|
|||
|
||||
logger.debug(f"Sending notification to {config['notifications_uri']}")
|
||||
|
||||
if status == "completed" and config["notifications_completed_triggerword"]:
|
||||
message = f"{message} {config['notifications_completed_triggerword']}"
|
||||
|
||||
# Get the body data
|
||||
body = config['notifications_body']
|
||||
formatted_body = dict()
|
||||
|
|
Loading…
Reference in New Issue