pass token to jenkins when triggering build (#68089)
This commit is contained in:
parent
d1a2c7c017
commit
a82caf6665
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue