1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
962 B
Bash

#!/bin/sh
# set username from secret if not supplied
[ -z "$PLUGIN_USERNAME" ] && [ -n "$SENDXMPP_USERNAME" ] && PLUGIN_USERNAME="${SENDXMPP_USERNAME}"
[ -z "$PLUGIN_PASSWORD" ] && [ -n "$SENDXMPP_PASSWORD" ] && PLUGIN_PASSWORD="${SENDXMPP_PASSWORD}"
# check if all required fields are set
[ -z "$PLUGIN_USERNAME" ] && echo "missing username or sendxmpp_username secret" && exit 123
[ -z "$PLUGIN_PASSWORD" ] && echo "missing password or sendxmpp_password secret" && exit 123
[ -z "$PLUGIN_JSERVER" ] && echo "missing jserver" && exit 123
[ -z "$PLUGIN_RECIPIENT" ] && echo "missing recipient" && exit 123
# create message from drone environment
[ -n "$DRONE_TAG"] && MSG="$DRONE_REPO_NAME:$DRONE_TAG" || MSG="$DRONE_REPO_NAME:$DRONE_TAG"
MSG="$MSG:$DRONE_BUILD_STATUS:$DRONE_BUILD_LINK"
CMD="sendxmpp \
-u ${PLUGIN_USERNAME} \
-j ${PLUGIN_JSERVER} \
-p ${PLUGIN_PASSWORD} \
--tls \
--verbose \
--no-tls-verify
${PLUGIN_RECIPIENT}"
echo $MSG | $CMD