pass token to jenkins when triggering build (#68089)

This commit is contained in:
Agate 2022-08-10 09:57:43 +02:00
parent d1a2c7c017
commit a82caf6665
1 changed files with 9 additions and 2 deletions

View File

@ -4,9 +4,16 @@ 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" || echo Failed to notify Jenkins
curl --max-time 5 --no-progress-meter "$TRIGGER_URL&token=$TOKEN" || echo Failed to notify Jenkins