Notify jenkins when a repo is updated (#67934)

This commit is contained in:
Agate 2022-08-04 13:47:26 +02:00
parent 1945ce257b
commit b0d2c672c9
2 changed files with 13 additions and 0 deletions

View File

@ -24,3 +24,7 @@ export GIT_CONFIG
tee >($BINDIR/post-receive-notify-updates 1>&2) \
| $BINDIR/post-receive-email 1>&2
export REPO_PATH=$(git rev-parse --show-toplevel)
export REPO_NAME=$(basename $REPO_PATH)
$BINDIR/post-receive-notify-jenkins 1>&2

9
post-receive-notify-jenkins Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
# Adapted from https://gist.github.com/vchatela/1cbca8f126b8ea8032ecd34b84164702
set -eu
REPOSITORY_URL=git://repos.entrouvert.org/$REPO_NAME.git
TRIGGER_URL=https://jenkins.entrouvert.org/git/notifyCommit?url=$REPOSITORY_URL
echo -n "Notifying Jenkins of changes to $REPOSITORY_URL..."
curl -m 5 "$TRIGGER_URL" || echo Failed to notify Jenkins