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