#!/bin/sh # Adapted from https://gist.github.com/vchatela/1cbca8f126b8ea8032ecd34b84164702 set -eu GITDIR=$(git rev-parse --absolute-git-dir) BASENAME=$(basename ${GITDIR}) REPOSITORY_URL=git://repos.entrouvert.org/${BASENAME} TRIGGER_URL=https://jenkins.entrouvert.org/git/notifyCommit?url=${REPOSITORY_URL} TOKEN_FILE=/etc/jenkins-notify-webhook-token if ! test -r ${TOKEN_FILE} then echo "missing Git plugin notifyCommit access tokens in ${TOKEN_FILE} -- see https://jenkins.entrouvert.org/configureSecurity/" exit 0 fi TOKEN=$(cat ${TOKEN_FILE}) echo -n "Notifying Jenkins of changes to $REPOSITORY_URL..." curl --max-time 5 --no-progress-meter "$TRIGGER_URL&token=$TOKEN" || echo Failed to notify Jenkins