woodpecker-xmpp/entrypoint.sh

19 lines
671 B
Bash

#!/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}