From 60869e4726d41e15184664c630e0d813377de587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Wed, 12 Oct 2022 11:13:21 +0200 Subject: [PATCH] Webhook support --- README.md | 6 ++++++ libexec/kiwi-backup/run_command | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/README.md b/README.md index db8015f..344c075 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,12 @@ backup: # Additional options for "duplicity remove-all-inc-of-but-n-full" command OPTIONS_RMINCR: "" + + # Webhook to be pinged on action (use "%%MSG%%" as a placeholder for a message) + WEBHOOK_URL: "" + + # Allow self-signed certificates on webhook target + WEBHOOK_INSECURE: "0" ``` ## Encryption diff --git a/libexec/kiwi-backup/run_command b/libexec/kiwi-backup/run_command index 4025b30..8d974de 100755 --- a/libexec/kiwi-backup/run_command +++ b/libexec/kiwi-backup/run_command @@ -19,6 +19,17 @@ if [ -n "${GPG_PASSPHRASE}" ]; then unset GPG_PASSPHRASE fi +# run webhook +if [ -n "${WEBHOOK_URL}" ]; then + wget_args="" + if [ "${WEBHOOK_INSECURE}" = "1" ]; then + wget_args="--no-check-certificate" + fi + + WEBHOOK_URL="$(echo "${WEBHOOK_URL}" | sed "s,%%MSG%%,running task ${*},g" )" + wget -O /dev/null ${wget_args} "${WEBHOOK_URL}" +fi + # hand over set -ex exec $( \