woodpecker-xmpp/entrypoint.sh

27 lines
762 B
Bash

#!/bin/bash
if [[ "${CI_BUILD_STATUS}" = "success" ]]; then
MESSAGE="✔️ Build for ${CI_COMMIT_SHA} on ${CI_REPO} succeeded."
else
MESSAGE="❌ Build for ${CI_COMMIT_SHA} on ${CI_REPO} failed on ${CI_MACHINE} (${CI_SYSTEM_ARCH}).\nSee ${CI_BUILD_LINK}"
fi
SERVER_DETAILS=""
if [[ ! -z "${XMPP_SERVER}" ]]; then
SERVER_DETAILS=(-j "${XMPP_SERVER}")
fi
SERVER_TLS=""
if [[ ! -z "${PLUGIN_XMPP_TLS}" ]]; then
SERVER_TLS=--tls
fi
GROUPCHAT=""
if [[ ! -z "${PLUGIN_XMPP_IS_MUC}" ]]; then
GROUPCHAT="-c"
# Make the bot nickname configurable
BOT_ALIAS=(-a ${PLUGIN_XMPP_ALIAS:-"Woodpecker CI"})
fi
echo -e "$MESSAGE" | go-sendxmpp -u ${XMPP_JID} -p ${XMPP_PASSWORD} ${SERVER_DETAILS[@]} ${SERVER_TLS} ${BOT_ALIAS} ${GROUPCHAT} ${PLUGIN_XMPP_MUC}