X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=server%2Fpost-receive-hudson;h=594be612268dd53fc69c2a6f1cf0bd8357f0ed07;hb=0ef545513bc77af8f8c6136f6c09fdfe245bb404;hp=9f57efa88bf7ab37b622ebdd2d03b64498d2952f;hpb=0bb65b2d324a36df831f92ee2a3d9182700a10f3;p=git-central.git diff --git a/server/post-receive-hudson b/server/post-receive-hudson index 9f57efa..594be61 100644 --- a/server/post-receive-hudson +++ b/server/post-receive-hudson @@ -1,4 +1,21 @@ #!/bin/sh +# +# Copyright (c) 2008 Stephen Haberman +# +# This hook creates new jobs for each branch in the Hudson continuous +# integration tool. Besides creating the job if needed, the user who pushed is +# added to the job's email list if they were not already there. +# +# Config +# ------ +# hooks.post-receive-hudson.url +# The url to hudson, e.g. http://internalbox/hudson +# hooks.post-receive-hudson.ignored +# Whitespace separated list of branches to not make jobs for. +# USER_EMAIL +# Environment variable that should be set by your repository-specific +# post-receive hook. E.g. export USER_EMAIL=${USER}@example.com +# . $(dirname $0)/functions @@ -17,14 +34,15 @@ while read oldrev newrev refname ; do esac ignored=" $(git config hooks.post-receive-hudson.ignored) " + hudson_url=$(git config hooks.post-receive-hudson.url) if [[ $ignored =~ " $short_refname " ]] ; then exit 0 fi - branch_config=$(wget -O - http://cbas1:8080/hudson/job/${short_refname}/config.xml 2>/dev/null) + branch_config=$(wget -O - $hudson_url/job/${short_refname}/config.xml 2>/dev/null) if [ $? -ne 0 ] ; then # Create the job - stable_config=$(wget -O - http://cbas1:8080/hudson/job/stable/config.xml 2>/dev/null) + stable_config=$(wget -O - $hudson_url/job/stable/config.xml 2>/dev/null) if [ $? -ne 0 ] ; then display_error_message "Could not get existing Hudson config for ${short_refname}" exit 0 @@ -39,7 +57,7 @@ while read oldrev newrev refname ; do fi # Make the new job - wget --header "Content-Type: text/xml" --post-data="$branch_config" -O - "http://cbas1:8080/hudson/createItem?name=${short_refname}" >/dev/null 2>/dev/null + wget --header "Content-Type: text/xml" --post-data="$branch_config" -O - "$hudson_url/createItem?name=${short_refname}" >/dev/null 2>/dev/null if [ $? -ne 0 ] ; then display_error_message "Could not create new Hudson job for ${short_refname}" exit 0 @@ -50,7 +68,7 @@ while read oldrev newrev refname ; do branch_config="${branch_config//$USER_EMAIL }" # Update the config - wget --header "Content-Type: text/xml" --post-data="$branch_config" -O - "http://cbas1:8080/hudson/job/${short_refname}/config.xml" >/dev/null 2>/dev/null + wget --header "Content-Type: text/xml" --post-data="$branch_config" -O - "$hudson_url/job/${short_refname}/config.xml" >/dev/null 2>/dev/null if [ $? -ne 0 ] ; then display_error_message "Could not add $USER_EMAIL to Hudson job ${short_refname}" exit 0