Forked from marten-cz/githook-postreceive-jenkins.sh
Last active
August 29, 2015 14:12
-
-
Save chaitu6022/f8bf278c8dc34b29a28b to your computer and use it in GitHub Desktop.
Revisions
-
marten-cz created this gist
Apr 4, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #!/bin/bash REPO="My-Job-Name" TOKEN="token from jenkins" JENKINSURL="http://login:[email protected]/" declare -A branches while read oldrev newrew ref; do if [ -z $ref ]; then ref=$newrev newrev="" fi echo "$oldrev $newrev $ref" >> /var/log/githook/githook.log if [ "${ref:0:11}" = "refs/heads/" ]; then branch=${ref:11} branches["${branch}"]="${branch}" fi done for branch in "${branches[@]}"; do echo "Project ${REPO} building ${branch}" >> /var/log/githook/git-post-receive.log curl -o /tmp/aaa.tmp --silent "${JENKINSURL}/job/${REPO}/buildWithParameters?token=${TOKEN}&cause=GIT+push&BRANCH=${branch}" >> /var/log/githook/git-post-receive.log done