From 6f4329f0025ecccebe944dac663de35bc90277b3 Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Tue, 23 Aug 2022 15:07:02 +0200 Subject: [PATCH] make xmpp image more ci-specific --- Makefile | 4 +-- sendxmpp/entrypoint.sh | 31 ------------------ {sendxmpp => xmpp-ci}/Dockerfile | 0 {sendxmpp => xmpp-ci}/Makefile | 2 +- xmpp-ci/entrypoint.sh | 55 ++++++++++++++++++++++++++++++++ 5 files changed, 58 insertions(+), 34 deletions(-) delete mode 100644 sendxmpp/entrypoint.sh rename {sendxmpp => xmpp-ci}/Dockerfile (100%) rename {sendxmpp => xmpp-ci}/Makefile (95%) create mode 100644 xmpp-ci/entrypoint.sh diff --git a/Makefile b/Makefile index 34630d8..55bf0c2 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ REGISTRY=registry.monotremata.xyz PLATFORMS=linux/amd64,linux/arm64 -IMAGES=agate buildx-qemu mpd pleroma rainloop rsync sendxmpp static-page-builder tor transmission webdav +IMAGES=agate buildx-qemu mpd pleroma rainloop rsync xmpp-ci static-page-builder tor transmission webdav .PHONY: all $(IMAGES) @@ -27,7 +27,7 @@ rainloop: rsync: $(BUILDX) -sendxmpp: +xmpp-ci: $(BUILDX) static-page-builder: diff --git a/sendxmpp/entrypoint.sh b/sendxmpp/entrypoint.sh deleted file mode 100644 index 1bf7448..0000000 --- a/sendxmpp/entrypoint.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -MESSAGE="${MESSAGE:-${PLUGIN_MESSAGE}}" -if [ -z "$MESSAGE" ]; then - echo "'message' must specified" - exit 1 -fi - -USERNAME="${USERNAME:-${PLUGIN_USERNAME}}" -if [ -z "$USERNAME" ]; then - echo "'username' must specified" - exit 1 -fi - -PASSWORD="${PASSWORD:-${PLUGIN_PASSWORD}}" -if [ -z "$USERNAME" ]; then - echo "'username' must specified" - exit 1 -fi - -RECIPIENT="${RECIPIENT:-${PLUGIN_RECIPIENT}}" -if [ -z "$RECIPIENT" ]; then - echo "'recipient' must specified" - exit 1 -fi - -exec echo "$MESSAGE" | \ - go-sendxmpp \ - --username="${USERNAME}"\ - --password="${PASSWORD}" \ - "${RECIPIENT}" diff --git a/sendxmpp/Dockerfile b/xmpp-ci/Dockerfile similarity index 100% rename from sendxmpp/Dockerfile rename to xmpp-ci/Dockerfile diff --git a/sendxmpp/Makefile b/xmpp-ci/Makefile similarity index 95% rename from sendxmpp/Makefile rename to xmpp-ci/Makefile index 5b33c4c..4ced80c 100644 --- a/sendxmpp/Makefile +++ b/xmpp-ci/Makefile @@ -1,4 +1,4 @@ -IMG_NAME=sendxmpp +IMG_NAME=xmpp-ci REGISTRY=registry.monotremata.xyz IMG=$(REGISTRY)/$(IMG_NAME) PLATFORMS=linux/amd64,linux/arm64 diff --git a/xmpp-ci/entrypoint.sh b/xmpp-ci/entrypoint.sh new file mode 100644 index 0000000..1b66c33 --- /dev/null +++ b/xmpp-ci/entrypoint.sh @@ -0,0 +1,55 @@ +#!/bin/sh + +USERNAME="${USERNAME:-${PLUGIN_USERNAME}}" +if [ -z "$USERNAME" ]; then + echo "'username' must specified" + exit 1 +fi + +PASSWORD="${PASSWORD:-${PLUGIN_PASSWORD}}" +if [ -z "$PASSWORD" ]; then + echo "'password' must specified" + exit 1 +fi + +RECIPIENT="${RECIPIENT:-${PLUGIN_RECIPIENT}}" +if [ -z "$RECIPIENT" ]; then + echo "'recipient' must specified" + exit 1 +fi + +em () { + echo "_${1}_" +} + +monospace () { + echo '`'"${1}"'`' +} + +strong () { + echo "*${1}*" +} + +strike () { + echo "~${1}~" +} + +build_line () { + echo "$1: $2" +} + +message () { + echo repo: "${CI_REPO_NAME}" + echo status: "${CI_BUILD_STATUS}" + echo branch: "${CI_REPO_DEFAULT_BRANCH}" + echo "" + echo commit msg: + echo "${CI_COMMIT_MESSAGE}" +} + +message +message | \ + go-sendxmpp \ + --username="${USERNAME}"\ + --password="${PASSWORD}" \ + "${RECIPIENT}"