Compare commits

...

9 Commits

Author SHA1 Message Date
7e6c871446 Add badge to README
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-01-10 17:06:06 +01:00
f0d2746b71 Improve output
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-01-10 16:54:00 +01:00
be7aa42d2a Change output text
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-01-10 15:12:04 +01:00
12598ec381 Force pull
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-01-10 15:10:43 +01:00
f99aabb164 Quote title
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-01-10 15:07:56 +01:00
d85767bdb1 Update entrypoint
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-01-10 15:05:05 +01:00
afdf818fe3 Verify token and url is set
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-01-10 13:51:50 +01:00
34f9c49d54 Update entrypoint
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-01-10 13:46:24 +01:00
7a4220931c Notify on push
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-01-10 13:45:26 +01:00
4 changed files with 35 additions and 3 deletions

View File

@ -26,3 +26,16 @@ pipeline:
- "${CI_COMMIT_TAG}"
when:
event: [tag]
notify:
image: registry.t-juice.club/plugin-gotify
pull: true
settings:
gotify_url: https://gotify.t-juice.club
gotify_token:
from_secret: gotify_token
title: plugin-gotify updated
message: latest update to ${CI_COMMIT_SHA:0:8}
when:
branch: master
event: [push]

View File

@ -1,4 +1,4 @@
FROM alpine:latest
RUN apk add --no-cache curl
RUN apk add --no-cache curl jq
COPY entrypoint.sh /bin/entrypoint.sh
CMD ["/bin/entrypoint.sh"]

View File

@ -1,3 +1,5 @@
![status-badge](https://ci.t-juice.club/api/badges/torjus/plugin-gotify/status.svg)
# plugin-gotify
Plugin for woodpecker to send messages to gotify.

View File

@ -1,4 +1,21 @@
#!/bin/sh
# TODO: Verify that variables are set properly
curl "${PLUGIN_GOTIFY_URL}/message?token=${PLUGIN_GOTIFY_TOKEN}" -F "title=${PLUGIN_TITLE}" -F "message=${PLUGIN_MESSAGE}" -F "priority=5"
if [ -z ${PLUGIN_GOTIFY_URL} ]; then
echo "PLUGIN_GOTIFY_URL is not set";
exit 1
fi
if [ -z ${PLUGIN_GOTIFY_TOKEN} ]; then
echo "PLUGIN_GOTIFY_TOKEN is not set";
exit 1
fi
OUTPUT_FILE=$(mktemp)
STATUS_CODE=$(curl -s --output "$OUTPUT_FILE" --write-out "%{http_code}" "${PLUGIN_GOTIFY_URL}/message?token=${PLUGIN_GOTIFY_TOKEN}" -F "title=${PLUGIN_TITLE}" -F "message=${PLUGIN_MESSAGE}" -F "priority=5")
if [ "$STATUS_CODE" -ne "200" ]; then
echo "Failed to send message:"
cat "$OUTPUT_FILE" | jq .
exit 1
fi
cat "$OUTPUT_FILE" | jq .