From bd51cb6b0ddb3d609d5728d61c0d6c79df20b7ef Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Fri, 18 Aug 2023 23:04:55 +0200 Subject: [PATCH] Initial commit --- Dockerfile | 8 ++++++++ entrypoint.sh | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 Dockerfile create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..70ddcd5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM alpine:3.18.3 + +# We need bash for parameter arrays +RUN apk add --no-cache go-sendxmpp bash + +# Include the main script +ADD --chmod=555 entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..dc35f5d --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/bash +if [[ "${WOODPECKER_BUILD_STATUS}" = "success" ]]; then + MESSAGE="✔️ Build for ${WOODPECKER_COMMIT_SHA} on ${WOODPECKER_REPO_OWNER}/${WOODPECKER_REPO_NAME} succeeded." +else + MESSAGE="❌ Build for ${WOODPECKER_COMMIT_SHA} on ${WOODPECKER_REPO_OWNER}/${WOODPECKER_REPO_NAME} failed.\nSee ${WOODPECKER_BUILD_LINK}" +fi + +SERVER_DETAILS="" +if [[ ! -z "${PLUGIN_XMPP_SERVER}" ]]; then + SERVER_DETAILS=(-j "${PLUGIN_XMPP_SERVER}") +fi + +SERVER_TLS="" +if [[ ! -z "${PLUGIN_XMPP_TLS}" ]]; then + SERVER_TLS=--tls +fi + +echo -e "$MESSAGE" | go-sendxmpp -u ${PLUGIN_XMPP_JID} -p ${PLUGIN_XMPP_PASSWORD} ${SERVER_DETAILS[@]} ${SERVER_TLS} -a 2B -c ${PLUGIN_XMPP_MUC}