initial import of gogs-notify script and a Docerkfile
This commit is contained in:
commit
6b36560b6d
|
@ -0,0 +1,7 @@
|
|||
FROM alpine:3.8
|
||||
|
||||
RUN apk add --no-cache ca-certificates curl
|
||||
|
||||
COPY gogs-notify /
|
||||
|
||||
ENTRY-POINT [/gogs-notify]
|
|
@ -0,0 +1,14 @@
|
|||
Create a user on Gogs for posting build notifications (like 'buildbot') and generate a token for it. Insert the token as a drone secret.
|
||||
|
||||
drone secret add dan/gogs-notify-test --name gogs_account_token --value $VALUE --event pull-request --event push --event tag --event deployment
|
||||
|
||||
Use in drone.yml:
|
||||
|
||||
notify-gogs:
|
||||
image: drone-gogs
|
||||
when:
|
||||
event: pull_request
|
||||
secrets: [gogs_account_token]
|
||||
gogs_url: https://git.openprivacy.ca
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
URL="$GOGS_URL/api/v1/repos/${DRONE_REPO}/issues/${DRONE_PULL_REQUEST}/comments"
|
||||
|
||||
RESULT=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GOGS_ACCOUNT_TOKEN" -H "Content-Type: application/json" -d "{\"Body\": \"Drone Build Status: ${DRONE_BUILD_STATUS}\n\n${DRONE_BUILD_LINK}\"}" -X POST $URL)
|
||||
CURL_RESULT=$?
|
||||
|
||||
if [ $RESULT -eq 201 ]
|
||||
then
|
||||
echo "Success posting to $URL"
|
||||
else
|
||||
echo "ERROR posting to $URL"
|
||||
echo "ERROR http: $RESULT curl: $CURL_RESULT"
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue