From 02e51e50d4f5f47f0678f3726f298e3198444ad4 Mon Sep 17 00:00:00 2001 From: Aaron Boxer Date: Fri, 8 Apr 2011 16:03:06 -0400 Subject: [PATCH 1/6] made post-receive-hudson work for me; also added sample of how to call post-receive-hudson --- server/functions | 23 ++++++++++----------- server/post-receive-hudson | 33 +++++++++++++++++++++---------- server/post-receive.hudson.sample | 33 +++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 21 deletions(-) create mode 100644 server/post-receive.hudson.sample diff --git a/server/functions b/server/functions index 5040ef7..987f734 100644 --- a/server/functions +++ b/server/functions @@ -85,7 +85,7 @@ # "remotes/" will be ignored as well. # ################################################## -function set_new_commits() { +set_new_commits() { nl=$'\n' # Get all the current branches, not'd as we want only new ones @@ -114,7 +114,7 @@ function set_new_commits() { # 0000->1234 (create) # 1234->2345 (update) # 2345->0000 (delete) -function set_change_type() { +set_change_type() { if [ "$oldrev" == "0000000000000000000000000000000000000000" ] ; then change_type="create" else @@ -129,7 +129,7 @@ function set_change_type() { # Sets: $newrev_type $oldrev_type $rev $rev_type # Assumes: $newrev $oldrev # --- Get the revision types -function set_rev_types() { +set_rev_types() { newrev_type=$(git cat-file -t "$newrev" 2> /dev/null) oldrev_type=$(git cat-file -t "$oldrev" 2> /dev/null) if [ "$newrev" == "0000000000000000000000000000000000000000" ] ; then @@ -145,7 +145,7 @@ function set_rev_types() { # Assumes: $rev # # The email subject will contain the best description of the ref that we can build from the parameters -function set_describe() { +set_describe() { rev_to_describe="$rev" if [ "$1" != "" ] ; then rev_to_describe="$1" @@ -161,7 +161,7 @@ function set_describe() { # Assumes: $rev # # The email subject will contain the best description of the ref that we can build from the parameters -function set_describe_tags() { +set_describe_tags() { rev_to_describe="$rev" if [ "$1" != "" ] ; then rev_to_describe="$1" @@ -184,7 +184,7 @@ function set_describe_tags() { # } # with_lock "foo.lock" several # Works # -function with_lock() { +with_lock() { lockfile="$1" block="$2" with_lock_has_lock=1 @@ -200,19 +200,20 @@ function with_lock() { with_lock_has_lock=1 } -function with_lock_unlock_if_held() { +with_lock_unlock_if_held() { if [[ "$with_lock_has_lock" -eq 0 ]] ; then rm -f "$lockfile" fi } -function display_error_message() { +display_error_message() { echo "----------------------------------------------------" >&2 echo "" >&2 echo "" >&2 - for ((i=1;i<=$#;i+=1)); do - eval message="$"$i - echo "$message" >&2 + for i in `seq 1 $#` + do + eval message="$"$i + echo "$message" >&2 done echo "" >&2 echo "" >&2 diff --git a/server/post-receive-hudson b/server/post-receive-hudson index 594be61..7c14359 100644 --- a/server/post-receive-hudson +++ b/server/post-receive-hudson @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Copyright (c) 2008 Stephen Haberman # @@ -19,7 +19,10 @@ . $(dirname $0)/functions -while read oldrev newrev refname ; do +# get committer's email address +USER_EMAIL=$(git log -1 --pretty=format:'%ce') + +while read oldrev newrev refname ; do case "$refname" in refs/tags/*) exit 0 @@ -39,25 +42,28 @@ while read oldrev newrev refname ; do exit 0 fi - branch_config=$(wget -O - $hudson_url/job/${short_refname}/config.xml 2>/dev/null) + jobName=$REPOSITORY_BASE_NAME$short_refname + jobUrl=$hudson_url"/job/"${jobName} + jobNameMaster=$REPOSITORY_BASE_NAME"master" + branch_config=$(wget -O - $jobUrl/config.xml 2>/dev/null) if [ $? -ne 0 ] ; then # Create the job - stable_config=$(wget -O - $hudson_url/job/stable/config.xml 2>/dev/null) + stable_config=$(wget -O - $hudson_url/job/${jobNameMaster}/config.xml 2>/dev/null) if [ $? -ne 0 ] ; then - display_error_message "Could not get existing Hudson config for ${short_refname}" + display_error_message "Could not get existing Hudson config for ${short_refname} at url ${hudson_url}" exit 0 fi # Replace stable with our branch - branch_config="${stable_config/stable$short_refname<}" - + branch_config="${stable_config/master$short_refname<}" + # Add email to recipients list if [ "${branch_config/$USER_EMAIL/}" == "$branch_config" ] ; then branch_config="${branch_config//$USER_EMAIL }" fi # Make the new job - wget --header "Content-Type: text/xml" --post-data="$branch_config" -O - "$hudson_url/createItem?name=${short_refname}" >/dev/null 2>/dev/null + wget --header "Content-Type: text/xml" --post-data="$branch_config" -O - "$hudson_url/createItem?name=${jobName}" >/dev/null 2>/dev/null if [ $? -ne 0 ] ; then display_error_message "Could not create new Hudson job for ${short_refname}" exit 0 @@ -68,13 +74,20 @@ 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 - "$hudson_url/job/${short_refname}/config.xml" >/dev/null 2>/dev/null + wget --header "Content-Type: text/xml" --post-data="$branch_config" -O - "$jobUrl/config.xml" >/dev/null 2>/dev/null if [ $? -ne 0 ] ; then - display_error_message "Could not add $USER_EMAIL to Hudson job ${short_refname}" + display_error_message "Could not add $USER_EMAIL to recipients list for Hudson job ${short_refname}" exit 0 fi fi + fi + +#Trigger Build +buildUrl=$jobUrl"/build" +curl -X POST $buildUrl -u git:banana -d token=$TOKEN --data-urlencode json="$JSON +" + done exit 0 diff --git a/server/post-receive.hudson.sample b/server/post-receive.hudson.sample new file mode 100644 index 0000000..429c795 --- /dev/null +++ b/server/post-receive.hudson.sample @@ -0,0 +1,33 @@ +#!/bin/sh +# +# An example hook script for the "post-receive" event. +# +# The "post-receive" script is run after receive-pack has accepted a pack +# and the repository has been updated. It is passed arguments in through +# stdin in the form +# +# For example: +# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master +# +# see contrib/hooks/ for a sample, or uncomment the next line and +# rename the file to "post-receive". + + +# get base repository name +if [ $(git rev-parse --is-bare-repository) = true ] +then + repositoryBaseName=$(basename "$PWD") + repositoryBaseName=${repositoryBaseName%.git} +else + repositoryBaseName=$(basename $(readlink -nf "$PWD"/..)) +fi + +export REPOSITORY_BASE_NAME=$repositoryBaseName + +export JSON="{\"parameter\": [{\"name\": \"Configuration\", \"value\": \"Release\"}, +{\"name\": \"DistributionBuild\", \"value\": \"FALSE\"}], \"\": \"\"}" + +export TOKEN="EGGPLANT" +/usr/share/doc/git-core/contrib/hooks/post-receive-hudson + + From 0c1a0b5cde22fb5575a6b99d29bf80eed40ec39b Mon Sep 17 00:00:00 2001 From: Aaron Boxer Date: Fri, 8 Apr 2011 16:03:06 -0400 Subject: [PATCH 2/6] made post-receive-hudson work for me; also added sample of how to call post-receive-hudson --- server/functions | 7 ++++--- server/post-receive-hudson | 31 ++++++++++++++++++++--------- server/post-receive.hudson.sample | 33 +++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 server/post-receive.hudson.sample diff --git a/server/functions b/server/functions index f00dcb9..f97a22b 100644 --- a/server/functions +++ b/server/functions @@ -211,9 +211,10 @@ display_error_message() { echo "----------------------------------------------------" >&2 echo "" >&2 echo "" >&2 - for ((i=1;i<=$#;i+=1)); do - eval message="$"$i - echo "$message" >&2 + for i in `seq 1 $#` + do + eval message="$"$i + echo "$message" >&2 done echo "" >&2 echo "" >&2 diff --git a/server/post-receive-hudson b/server/post-receive-hudson index 45ce301..0762698 100755 --- a/server/post-receive-hudson +++ b/server/post-receive-hudson @@ -20,7 +20,10 @@ . $(dirname $0)/functions -while read oldrev newrev refname ; do +# get committer's email address +USER_EMAIL=$(git log -1 --pretty=format:'%ce') + +while read oldrev newrev refname ; do case "$refname" in refs/tags/*) exit 0 @@ -44,25 +47,28 @@ while read oldrev newrev refname ; do USER_EMAIL=$(git log -1 --pretty=format:'%ce' $newrev) fi - branch_config=$(wget -O - $hudson_url/job/${short_refname}/config.xml 2>/dev/null) + jobName=$REPOSITORY_BASE_NAME$short_refname + jobUrl=$hudson_url"/job/"${jobName} + jobNameMaster=$REPOSITORY_BASE_NAME"master" + branch_config=$(wget -O - $jobUrl/config.xml 2>/dev/null) if [ $? -ne 0 ] ; then # Create the job - stable_config=$(wget -O - $hudson_url/job/stable/config.xml 2>/dev/null) + stable_config=$(wget -O - $hudson_url/job/${jobNameMaster}/config.xml 2>/dev/null) if [ $? -ne 0 ] ; then - display_error_message "Could not get existing Hudson config for ${short_refname}" + display_error_message "Could not get existing Hudson config for ${short_refname} at url ${hudson_url}" exit 0 fi # Replace stable with our branch - branch_config="${stable_config/stable$short_refname<}" - + branch_config="${stable_config/master$short_refname<}" + # Add email to recipients list if [ "${branch_config/$USER_EMAIL/}" == "$branch_config" ] ; then branch_config="${branch_config//$USER_EMAIL }" fi # Make the new job - wget --header "Content-Type: text/xml" --post-data="$branch_config" -O - "$hudson_url/createItem?name=${short_refname}" >/dev/null 2>/dev/null + wget --header "Content-Type: text/xml" --post-data="$branch_config" -O - "$hudson_url/createItem?name=${jobName}" >/dev/null 2>/dev/null if [ $? -ne 0 ] ; then display_error_message "Could not create new Hudson job for ${short_refname}" exit 0 @@ -73,13 +79,20 @@ 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 - "$hudson_url/job/${short_refname}/config.xml" >/dev/null 2>/dev/null + wget --header "Content-Type: text/xml" --post-data="$branch_config" -O - "$jobUrl/config.xml" >/dev/null 2>/dev/null if [ $? -ne 0 ] ; then - display_error_message "Could not add $USER_EMAIL to Hudson job ${short_refname}" + display_error_message "Could not add $USER_EMAIL to recipients list for Hudson job ${short_refname}" exit 0 fi fi + fi + +#Trigger Build +buildUrl=$jobUrl"/build" +curl -X POST $buildUrl -u git:banana -d token=$TOKEN --data-urlencode json="$JSON +" + done exit 0 diff --git a/server/post-receive.hudson.sample b/server/post-receive.hudson.sample new file mode 100644 index 0000000..429c795 --- /dev/null +++ b/server/post-receive.hudson.sample @@ -0,0 +1,33 @@ +#!/bin/sh +# +# An example hook script for the "post-receive" event. +# +# The "post-receive" script is run after receive-pack has accepted a pack +# and the repository has been updated. It is passed arguments in through +# stdin in the form +# +# For example: +# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master +# +# see contrib/hooks/ for a sample, or uncomment the next line and +# rename the file to "post-receive". + + +# get base repository name +if [ $(git rev-parse --is-bare-repository) = true ] +then + repositoryBaseName=$(basename "$PWD") + repositoryBaseName=${repositoryBaseName%.git} +else + repositoryBaseName=$(basename $(readlink -nf "$PWD"/..)) +fi + +export REPOSITORY_BASE_NAME=$repositoryBaseName + +export JSON="{\"parameter\": [{\"name\": \"Configuration\", \"value\": \"Release\"}, +{\"name\": \"DistributionBuild\", \"value\": \"FALSE\"}], \"\": \"\"}" + +export TOKEN="EGGPLANT" +/usr/share/doc/git-core/contrib/hooks/post-receive-hudson + + From 11d669e80eb05008f03889d4edd2bf358ab1c90e Mon Sep 17 00:00:00 2001 From: Aaron Boxer Date: Thu, 21 Apr 2011 15:25:36 -0400 Subject: [PATCH 3/6] got the post receive hudson working: needed to support both calling from command line and calling from another script --- server/post-receive-hudson | 44 ++++++++++++++++++++++--------- server/post-receive.hudson.sample | 3 +-- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/server/post-receive-hudson b/server/post-receive-hudson index 0762698..bcbf0c5 100755 --- a/server/post-receive-hudson +++ b/server/post-receive-hudson @@ -10,43 +10,51 @@ # ------ # hooks.post-receive-hudson.url # The url to hudson, e.g. http://internalbox/hudson +# hooks.post-receive-hudson.user +# Hudson user name +# hooks.post-receive-hudson.password +# Hudson password # 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. If -# unset, defaults to the email by of the pushed commit. +# post-receive hook. E.g. export USER_EMAIL=${USER}@example.com # . $(dirname $0)/functions -# get committer's email address -USER_EMAIL=$(git log -1 --pretty=format:'%ce') -while read oldrev newrev refname ; do - case "$refname" in +hudson() +{ + + case "$1" in refs/tags/*) exit 0 ;; refs/heads/*) - short_refname=${refname##refs/heads/} + short_refname=${1##refs/heads/} ;; *) - echo >&2 "*** Unknown type of update to $refname" + display_error_message "*** Unknown type of update to $1" exit 1 ;; esac + echo "Check ignore list" 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 - if [ -z "$USER_EMAIL" ] ; then + # parse USER_EMAIL from git log if not set + if [ -z "$USER_EMAIL" ] ; then USER_EMAIL=$(git log -1 --pretty=format:'%ce' $newrev) fi + + jobName=$REPOSITORY_BASE_NAME$short_refname jobUrl=$hudson_url"/job/"${jobName} jobNameMaster=$REPOSITORY_BASE_NAME"master" @@ -88,12 +96,22 @@ while read oldrev newrev refname ; do fi -#Trigger Build +echo "Trigger Build for job $jobUrl" buildUrl=$jobUrl"/build" -curl -X POST $buildUrl -u git:banana -d token=$TOKEN --data-urlencode json="$JSON +hudson_user=$(git config hooks.post-receive-hudson.user) +hudson_password=$(git config hooks.post-receive-hudson.password) +curl -X POST $buildUrl -u $hudson_user:$hudson_password -d token=$TOKEN --data-urlencode json="$JSON " -done +} -exit 0 +# Main() +if [ -n "$1" ]; then + hudson $1 +else + while read oldrev newrev refname + do + hudson $refname + done +fi diff --git a/server/post-receive.hudson.sample b/server/post-receive.hudson.sample index 429c795..bad4647 100644 --- a/server/post-receive.hudson.sample +++ b/server/post-receive.hudson.sample @@ -12,7 +12,6 @@ # see contrib/hooks/ for a sample, or uncomment the next line and # rename the file to "post-receive". - # get base repository name if [ $(git rev-parse --is-bare-repository) = true ] then @@ -28,6 +27,6 @@ export JSON="{\"parameter\": [{\"name\": \"Configuration\", \"value\": \"Release {\"name\": \"DistributionBuild\", \"value\": \"FALSE\"}], \"\": \"\"}" export TOKEN="EGGPLANT" -/usr/share/doc/git-core/contrib/hooks/post-receive-hudson +/usr/share/doc/git-core/contrib/hooks/post-receive-hudson From d3850431defc18acdba3ce2176315c473ce502d3 Mon Sep 17 00:00:00 2001 From: Aaron Boxer Date: Tue, 26 Apr 2011 13:49:42 -0400 Subject: [PATCH 4/6] 1. post-receive is a real-world sample from my git repo - might be instructive for users 2. added post-receive-redmine script, which pushes changes to redmine copy of repository 3. improved post-receive-hudson: added configurable parent job name and parent branch name, where the parent job is used as a template to create new hudson jobs (for new branches) --- server/post-receive-hudson | 47 +++++++++++++++++-------- server/post-receive-redmine | 58 +++++++++++++++++++++++++++++++ server/post-receive.hudson.sample | 32 ----------------- server/post-receive.sample | 36 +++++++++++++++++-- 4 files changed, 124 insertions(+), 49 deletions(-) create mode 100644 server/post-receive-redmine delete mode 100644 server/post-receive.hudson.sample diff --git a/server/post-receive-hudson b/server/post-receive-hudson index bcbf0c5..c0439eb 100755 --- a/server/post-receive-hudson +++ b/server/post-receive-hudson @@ -19,23 +19,32 @@ # USER_EMAIL # Environment variable that should be set by your repository-specific # post-receive hook. E.g. export USER_EMAIL=${USER}@example.com -# +# NAMESPACE +# Prefix all hudson job names with $NAMESPACE. +# Useful for hudson installations building mutliple repostories +# PARENT_JOB +# name of hudson job (minus $NAMESPACE, if set) to be used as a template +# to create new jobs for new branches +# PARENT_BRANCH +# git branch of PARENT_JOB . $(dirname $0)/functions +# This function is passed arguments through stdin in the form +# hudson() { - case "$1" in + case "$3" in refs/tags/*) exit 0 ;; refs/heads/*) - short_refname=${1##refs/heads/} + short_refname=${3##refs/heads/} ;; *) - display_error_message "*** Unknown type of update to $1" + display_error_message "*** Unknown type of update to $3" exit 1 ;; esac @@ -50,25 +59,33 @@ hudson() # parse USER_EMAIL from git log if not set if [ -z "$USER_EMAIL" ] ; then - USER_EMAIL=$(git log -1 --pretty=format:'%ce' $newrev) + USER_EMAIL=$(git log -1 --pretty=format:'%ce' $2) fi + job=$NAMESPACE$short_refname + jobUrl=$hudson_url"/job/"${job} + + if [ -z "$PARENT_JOB" ] ; then + PARENT_JOB="master" + fi + + if [ -z "$PARENT_BRANCH" ] ; then + PARENT_BRANCH="master" + fi - jobName=$REPOSITORY_BASE_NAME$short_refname - jobUrl=$hudson_url"/job/"${jobName} - jobNameMaster=$REPOSITORY_BASE_NAME"master" + jobParent=$NAMESPACE$PARENT_JOB branch_config=$(wget -O - $jobUrl/config.xml 2>/dev/null) if [ $? -ne 0 ] ; then # Create the job - stable_config=$(wget -O - $hudson_url/job/${jobNameMaster}/config.xml 2>/dev/null) + stable_config=$(wget -O - $hudson_url/job/${jobParent}/config.xml 2>/dev/null) if [ $? -ne 0 ] ; then display_error_message "Could not get existing Hudson config for ${short_refname} at url ${hudson_url}" exit 0 fi # Replace stable with our branch - branch_config="${stable_config/master$short_refname<}" + branch_config="${stable_config/$PARENT_BRANCH$short_refname<}" # Add email to recipients list if [ "${branch_config/$USER_EMAIL/}" == "$branch_config" ] ; then @@ -76,9 +93,9 @@ hudson() fi # Make the new job - wget --header "Content-Type: text/xml" --post-data="$branch_config" -O - "$hudson_url/createItem?name=${jobName}" >/dev/null 2>/dev/null + wget --header "Content-Type: text/xml" --post-data="$branch_config" -O - "$hudson_url/createItem?name=${job}" >/dev/null 2>/dev/null if [ $? -ne 0 ] ; then - display_error_message "Could not create new Hudson job for ${short_refname}" + display_error_message "Could not create new Hudson job ${job} for ${short_refname}" exit 0 fi else @@ -107,11 +124,11 @@ curl -X POST $buildUrl -u $hudson_user:$hudson_password -d token=$TOKEN --data-u # Main() -if [ -n "$1" ]; then - hudson $1 +if [ -n "$1" -a -n "$2" -a -n "$3" ]; then + hudson $1 $2 $3 else while read oldrev newrev refname do - hudson $refname + hudson $oldrev $newrev $refname done fi diff --git a/server/post-receive-redmine b/server/post-receive-redmine new file mode 100644 index 0000000..7b84020 --- /dev/null +++ b/server/post-receive-redmine @@ -0,0 +1,58 @@ +#!/bin/sh +# PostRecieve Hook to update and create bare clones for use with Redmine. +# GIT_REPO_TYPE Takes either ssh or file. +# GIT_REPO_BASE is only for ssh use and should be the user@URL +# set -x +user="git" +group="www-data" +GIT_REDMINE_BASE="/sn/git/checkouts" +GIT_REPO_TYPE="file" +GIT_REPO_BASE="user@URL" + +GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) +if [ -z "$GIT_DIR" ]; then + echo >&2 "fatal: post-receive: GIT_DIR not set" + exit 1 +fi + +if [ ! -d $GIT_REDMINE_BASE ]; then + GIT_REDMINE_BASE_TEMP=$(git config hooks.redmineGitBase) + if [ -z "$GIT_REDMINE_BASE_TEMP" ]; then + echo >&2 "fatal: post-receive: redmineGitBase not set" + exit 1 + else + GIT_REDMINE_BASE="$GIT_REDMINE_BASE_TEMP" + fi +fi + +cd "$GIT_DIR" +if [ -d "$GIT_REDMINE_BASE/$(basename $PWD .git)" ]; then + git push "$GIT_REDMINE_BASE/$(basename $PWD .git)" + if [ $? -eq 0 ]; then + echo "Successfully updated Redmine $(basename $PWD .git) bare repository" + else + echo "Failed to update Redmine $(basename $PWD .git) bare repository" + fi +else + GIT_DIR="$PWD" + BASE_DIR="$(basename $GIT_DIR .git)" + cloned=0 + cd "$GIT_REDMINE_BASE" + if [ "$GIT_REPO_TYPE" = "ssh" ] && [ ! -z $GIT_REPO_BASE ]; then + git clone --bare "$GIT_REPO_BASE:$BASE_DIR" "$GIT_REDMINE_BASE/$BASE_DIR" + if [ $? -eq 0 ]; then + cloned=1 + fi + elif [ "$GIT_REPO_TYPE" = "file" ]; then + git clone --bare "$GIT_DIR" "$GIT_REDMINE_BASE/$BASE_DIR" + if [ $? -eq 0 ]; then + cloned=1 + fi + fi + if [ $cloned -eq 1 ]; then + echo "Successfully created $BASE_DIR repository in $GIT_REDMINE_BASE" + chown "$user:$group" -Rf "$GIT_REDMINE_BASE/$BASE_DIR" + chmod 775 -Rf "$GIT_REDMINE_BASE/$BASE_DIR" + chmod -x -Rf "$GIT_REDMINE_BASE/$BASE_DIR/hooks" + fi +fi diff --git a/server/post-receive.hudson.sample b/server/post-receive.hudson.sample deleted file mode 100644 index bad4647..0000000 --- a/server/post-receive.hudson.sample +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# -# An example hook script for the "post-receive" event. -# -# The "post-receive" script is run after receive-pack has accepted a pack -# and the repository has been updated. It is passed arguments in through -# stdin in the form -# -# For example: -# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master -# -# see contrib/hooks/ for a sample, or uncomment the next line and -# rename the file to "post-receive". - -# get base repository name -if [ $(git rev-parse --is-bare-repository) = true ] -then - repositoryBaseName=$(basename "$PWD") - repositoryBaseName=${repositoryBaseName%.git} -else - repositoryBaseName=$(basename $(readlink -nf "$PWD"/..)) -fi - -export REPOSITORY_BASE_NAME=$repositoryBaseName - -export JSON="{\"parameter\": [{\"name\": \"Configuration\", \"value\": \"Release\"}, -{\"name\": \"DistributionBuild\", \"value\": \"FALSE\"}], \"\": \"\"}" - -export TOKEN="EGGPLANT" -/usr/share/doc/git-core/contrib/hooks/post-receive-hudson - - diff --git a/server/post-receive.sample b/server/post-receive.sample index 2c22dc5..2c372b0 100644 --- a/server/post-receive.sample +++ b/server/post-receive.sample @@ -1,4 +1,16 @@ #!/bin/bash +# +# An example hook script for the "post-receive" event. +# +# The "post-receive" script is run after receive-pack has accepted a pack +# and the repository has been updated. It is passed arguments in through +# stdin in the form +# +# For example: +# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master +# +# see contrib/hooks/ for a sample, or uncomment the next line and +# rename the file to "post-receive". nl=$'\n' input="" @@ -6,6 +18,26 @@ while read newref oldref refname ; do input="$input$newref $oldref $refname$nl" done -echo -n "$input" | /srv/git/gc/server/post-receive-one -echo -n "$input" | /srv/git/gc/server/post-receive-two + +echo -n "$input" | /usr/share/doc/git-core/contrib/hooks/post-receive-email +echo -n "$input" | /usr/share/doc/git-core/contrib/hooks/post-receive-redmine + + +# namespace +if [ $(git rev-parse --is-bare-repository) = true ] +then + namespace=$(basename "$PWD") + namespace=${namespace%.git} +else + namespace=$(basename $(readlink -nf "$PWD"/..)) +fi + +export NAMESPACE=$namespace + +export JSON="{\"parameter\": [{\"name\": \"Configuration\", \"value\": \"Release\"}, +{\"name\": \"DistributionBuild\", \"value\": \"FALSE\"}], \"\": \"\"}" + +export TOKEN="EGGPLANT" +echo -n "$input" | /usr/share/doc/git-core/contrib/hooks/post-receive-hudson + From ca0f957b1bd35505ebdf412507a111c444517f83 Mon Sep 17 00:00:00 2001 From: Aaron Boxer Date: Tue, 26 Apr 2011 14:26:18 -0400 Subject: [PATCH 5/6] added --all to git push, in order to push new branches --- server/post-receive-redmine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/post-receive-redmine b/server/post-receive-redmine index 7b84020..edc9b1c 100644 --- a/server/post-receive-redmine +++ b/server/post-receive-redmine @@ -27,7 +27,7 @@ fi cd "$GIT_DIR" if [ -d "$GIT_REDMINE_BASE/$(basename $PWD .git)" ]; then - git push "$GIT_REDMINE_BASE/$(basename $PWD .git)" + git push --all "$GIT_REDMINE_BASE/$(basename $PWD .git)" if [ $? -eq 0 ]; then echo "Successfully updated Redmine $(basename $PWD .git) bare repository" else From b53d046ed57dc52bf4a06bea65ea57243ce3370e Mon Sep 17 00:00:00 2001 From: Aaron Boxer Date: Wed, 6 Jul 2011 16:30:02 -0700 Subject: [PATCH 6/6] post-receive-hudson does not kick off a build if a branch is being deleted; also added our custom post-receive-email script --- server/post-receive-email | 427 +++++++++++++++++++++++++++---------- server/post-receive-hudson | 30 ++- 2 files changed, 346 insertions(+), 111 deletions(-) diff --git a/server/post-receive-email b/server/post-receive-email index cc39f38..f36653a 100755 --- a/server/post-receive-email +++ b/server/post-receive-email @@ -1,36 +1,53 @@ -#!/bin/bash +#!/bin/sh # # Copyright (c) 2007 Andy Parkins -# Copyright (c) 2008 Stephen Haberman # -# This hook sends emails listing new revisions to the repository introduced by -# the change being reported. The rule is that (for branch updates) each commit +# An example hook script to mail out commit update information. This hook +# sends emails listing new revisions to the repository introduced by the +# change being reported. The rule is that (for branch updates) each commit # will appear on one email and one email only. # -# Differences from the contrib script (off the top of my head): +# This hook is stored in the contrib/hooks directory. Your distribution +# will have put this somewhere standard. You should make this script +# executable then link to it in the repository you would like to use it in. +# For example, on debian the hook is stored in +# /usr/share/doc/git-core/contrib/hooks/post-receive-email: # -# * Sends combined diff output which is great for viewing merge commits -# * Changes order of commit listing to be oldest to newest -# * Configurable sendmail path -# * Use git describe --tags for the email subject to pick up commitnumbers +# chmod a+x post-receive-email +# cd /path/to/your/repository.git +# ln -sf /usr/share/doc/git-core/contrib/hooks/post-receive-email hooks/post-receive +# +# This hook script assumes it is enabled on the central repository of a +# project, with all users pushing only to it and not between each other. It +# will still work if you don't operate in that style, but it would become +# possible for the email to be from someone other than the person doing the +# push. # # Config # ------ -# hooks.post-receive-email.mailinglist +# hooks.mailinglist # This is the list that all pushes will go to; leave it blank to not send # emails for every ref update. -# hooks.post-receive-email.announcelist +# hooks.announcelist # This is the list that all pushes of annotated tags will go to. Leave it # blank to default to the mailinglist field. The announce emails lists # the short log summary of the changes since the last annotated tag. -# hooks.post-receive-email.envelopesender +# hooks.envelopesender # If set then the -f option is passed to sendmail to allow the envelope # sender address to be set -# hooks.post-receive-email.sendmail -# The path to sendmail, e.g. /usr/sbin/sendmail or /bin/msmtp -# USER_EMAIL -# Environment variable that should be set by your repository-specific -# post-receive hook. E.g. export USER_EMAIL=${USER}@example.com +# hooks.emailprefix +# All emails have their subjects prefixed with this prefix, or "[SCM]" +# if emailprefix is unset, to aid filtering +# hooks.showrev +# The shell command used to format each revision in the email, with +# "%s" replaced with the commit id. Defaults to "git rev-list -1 +# --pretty %s", displaying the commit id, author, date and log +# message. To list full patches separated by a blank line, you +# could set this to "git show -C %s; echo". +# To list a gitweb/cgit URL *and* a full patch for each change set, use this: +# "t=%s; printf 'http://.../?id=%%s' \$t; echo;echo; git show -C \$t; echo" +# Be careful if "..." contains things that will be expanded by shell "eval" +# or printf. # # Notes # ----- @@ -41,8 +58,6 @@ # ---------------------------- Functions -. $(dirname $0)/functions - # # Top level email generation function. This decides what type of update # this is and calls the appropriate body-generation routine after outputting @@ -54,6 +69,7 @@ # - generate_create_XXXX_email # - generate_update_XXXX_email # - generate_delete_XXXX_email +# - generate_email_footer # generate_email() { @@ -62,9 +78,35 @@ generate_email() newrev=$(git rev-parse $2) refname="$3" - set_change_type - set_rev_types - set_describe_tags + # --- Interpret + # 0000->1234 (create) + # 1234->2345 (update) + # 2345->0000 (delete) + if expr "$oldrev" : '0*$' >/dev/null + then + change_type="create" + else + if expr "$newrev" : '0*$' >/dev/null + then + change_type="delete" + else + change_type="update" + fi + fi + + # --- Get the revision types + newrev_type=$(git cat-file -t $newrev 2> /dev/null) + oldrev_type=$(git cat-file -t "$oldrev" 2> /dev/null) + case "$change_type" in + create|update) + rev="$newrev" + rev_type="$newrev_type" + ;; + delete) + rev="$oldrev" + rev_type="$oldrev_type" + ;; + esac # The revision type tells us what type the commit is, combined with # the location of the ref we can decide between @@ -76,13 +118,11 @@ generate_email() refs/tags/*,commit) # un-annotated tag refname_type="tag" - function="ltag" short_refname=${refname##refs/tags/} ;; refs/tags/*,tag) # annotated tag refname_type="annotated tag" - function="atag" short_refname=${refname##refs/tags/} # change recipients if [ -n "$announcerecipients" ]; then @@ -92,7 +132,6 @@ generate_email() refs/heads/*,commit) # branch refname_type="branch" - function="branch" short_refname=${refname##refs/heads/} ;; refs/remotes/*,commit) @@ -115,10 +154,10 @@ generate_email() if [ -z "$recipients" ]; then case "$refname_type" in "annotated tag") - config_name="hooks.post-receive-email.announcelist" + config_name="hooks.announcelist" ;; *) - config_name="hooks.post-receive-email.mailinglist" + config_name="hooks.mailinglist" ;; esac echo >&2 "*** $config_name is not set so no email will be sent" @@ -126,8 +165,33 @@ generate_email() exit 0 fi + # Email parameters + # The email subject will contain the best description of the ref + # that we can build from the parameters + describe=$(git describe $rev 2>/dev/null) + if [ -z "$describe" ]; then + describe=$rev + fi + generate_email_header - generate_${change_type}_${function}_email + + # Call the correct body generation function + fn_name=general + case "$refname_type" in + "tracking branch"|branch) + fn_name=branch + ;; + "annotated tag") + fn_name=atag + ;; + esac + generate_${change_type}_${fn_name}_email + + generate_email_footer + + #EXECUTE SOME MORE CODE + # NOT THE GREATEST PLACE TO PUT THIS BUT I CAN'T FIGURE OUT WHERE BETTER FOR IT TO GO TO TO CAPTURE THE STDIN + /usr/bin/php /usr/share/doc/git-core/contrib/hooks/check-affected-servers.php $oldrev $newrev $refname } generate_email_header() @@ -135,18 +199,33 @@ generate_email_header() # --- Email (all stdout will be the email) # Generate header cat <<-EOF - From: $USER_EMAIL To: $recipients - Subject: ${emailprefix} $short_refname $refname_type ${change_type}d. $describe_tags + Subject: ${emailprefix}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe + Content-Type: text/plain; charset=utf-8 X-Git-Refname: $refname X-Git-Reftype: $refname_type X-Git-Oldrev: $oldrev X-Git-Newrev: $newrev + This is an automated email from the git hooks/post-receive script. It was + generated because a ref change was pushed to the repository containing + the project "$projectdesc". + The $refname_type, $short_refname has been ${change_type}d EOF } +generate_email_footer() +{ + SPACE=" " + cat <<-EOF + + + hooks/post-receive + --${SPACE} + $projectdesc + EOF +} # --------------- Branches @@ -156,26 +235,12 @@ generate_email_header() generate_create_branch_email() { # This is a new branch and so oldrev is not valid - git rev-list --pretty=format:" at %h %s" --no-walk "$newrev" | grep -vP "^commit" - - set_new_commits - + echo " at $newrev ($newrev_type)" echo "" - echo $LOGBEGIN - echo "$new_commits" | git rev-list --reverse --stdin | while read commit ; do - echo "" - git rev-list --no-walk --pretty "$commit" - git diff-tree --cc "$commit" - echo "" - echo $LOGEND - done - oldest_new=$(echo "$new_commits" | git rev-list --stdin | tail -n 1) - if [ "$oldest_new" != "" ] ; then - echo "" - echo "Summary of changes:" - git diff-tree --stat $oldest_new^..$newrev - fi + echo $LOGBEGIN + show_new_revisions + echo $LOGEND } # @@ -183,20 +248,120 @@ generate_create_branch_email() # generate_update_branch_email() { - # List all of the revisions that were removed by this update (hopefully empty) - git rev-list --first-parent --pretty=format:" discards %h %s" $newrev..$oldrev | grep -vP "^commit" + # Consider this: + # 1 --- 2 --- O --- X --- 3 --- 4 --- N + # + # O is $oldrev for $refname + # N is $newrev for $refname + # X is a revision pointed to by some other ref, for which we may + # assume that an email has already been generated. + # In this case we want to issue an email containing only revisions + # 3, 4, and N. Given (almost) by + # + # git rev-list N ^O --not --all + # + # The reason for the "almost", is that the "--not --all" will take + # precedence over the "N", and effectively will translate to + # + # git rev-list N ^O ^X ^N + # + # So, we need to build up the list more carefully. git rev-parse + # will generate a list of revs that may be fed into git rev-list. + # We can get it to make the "--not --all" part and then filter out + # the "^N" with: + # + # git rev-parse --not --all | grep -v N + # + # Then, using the --stdin switch to git rev-list we have effectively + # manufactured + # + # git rev-list N ^O ^X + # + # This leaves a problem when someone else updates the repository + # while this script is running. Their new value of the ref we're + # working on would be included in the "--not --all" output; and as + # our $newrev would be an ancestor of that commit, it would exclude + # all of our commits. What we really want is to exclude the current + # value of $refname from the --not list, rather than N itself. So: + # + # git rev-parse --not --all | grep -v $(git rev-parse $refname) + # + # Get's us to something pretty safe (apart from the small time + # between refname being read, and git rev-parse running - for that, + # I give up) + # + # + # Next problem, consider this: + # * --- B --- * --- O ($oldrev) + # \ + # * --- X --- * --- N ($newrev) + # + # That is to say, there is no guarantee that oldrev is a strict + # subset of newrev (it would have required a --force, but that's + # allowed). So, we can't simply say rev-list $oldrev..$newrev. + # Instead we find the common base of the two revs and list from + # there. + # + # As above, we need to take into account the presence of X; if + # another branch is already in the repository and points at some of + # the revisions that we are about to output - we don't want them. + # The solution is as before: git rev-parse output filtered. + # + # Finally, tags: 1 --- 2 --- O --- T --- 3 --- 4 --- N + # + # Tags pushed into the repository generate nice shortlog emails that + # summarise the commits between them and the previous tag. However, + # those emails don't include the full commit messages that we output + # for a branch update. Therefore we still want to output revisions + # that have been output on a tag email. + # + # Luckily, git rev-parse includes just the tool. Instead of using + # "--all" we use "--branches"; this has the added benefit that + # "remotes/" will be ignored as well. + + # List all of the revisions that were removed by this update, in a + # fast-forward update, this list will be empty, because rev-list O + # ^N is empty. For a non-fast-forward, O ^N is the list of removed + # revisions + fast_forward="" + rev="" + for rev in $(git rev-list $newrev..$oldrev) + do + revtype=$(git cat-file -t "$rev") + echo " discards $rev ($revtype)" + done + if [ -z "$rev" ]; then + fast_forward=1 + fi - # List all of the revisions that were added by this update - git rev-list --first-parent --pretty=format:" via %h %s" $oldrev..$newrev | grep -vP "^commit" + # List all the revisions from baserev to newrev in a kind of + # "table-of-contents"; note this list can include revisions that + # have already had notification emails and is present to show the + # full detail of the change from rolling back the old revision to + # the base revision and then forward to the new revision + for rev in $(git rev-list $oldrev..$newrev) + do + revtype=$(git cat-file -t "$rev") + echo " via $rev ($revtype)" + done - removed=$(git rev-list $newrev..$oldrev) - if [ "$removed" == "" ] ; then - git rev-list --no-walk --pretty=format:" from %h %s" $oldrev | grep -vP "^commit" + if [ "$fast_forward" ]; then + echo " from $oldrev ($oldrev_type)" else - # Must be rewind, could be rewind+addition + # 1. Existing revisions were removed. In this case newrev + # is a subset of oldrev - this is the reverse of a + # fast-forward, a rewind + # 2. New revisions were added on top of an old revision, + # this is a rewind and addition. + + # (1) certainly happened, (2) possibly. When (2) hasn't + # happened, we set a flag to indicate that no log printout + # is required. + echo "" - # Find the common ancestor of the old and new revisions and compare it with newrev + # Find the common ancestor of the old and new revisions and + # compare it with newrev baserev=$(git merge-base $oldrev $newrev) rewind_only="" if [ "$baserev" = "$newrev" ]; then @@ -232,29 +397,29 @@ generate_update_branch_email() echo "not appeared on any other notification email; so we list those" echo "revisions in full, below." - set_new_commits - echo "" echo $LOGBEGIN - echo "$new_commits" | git rev-list --reverse --stdin | while read commit ; do - echo "" - git rev-list --no-walk --pretty "$commit" - git diff-tree --cc "$commit" - echo "" - echo $LOGEND - done + show_new_revisions # XXX: Need a way of detecting whether git rev-list actually # outputted anything, so that we can issue a "no new # revisions added by this update" message + + echo $LOGEND else echo "No new revisions were added by this update." fi - # Show the diffstat which is what really happened (new commits/whatever aside) + # The diffstat is shown from the old revision to the new revision. + # This is to show the truth of what happened in this change. + # There's no point showing the stat from the base to the new + # revision because the base is effectively a random revision at this + # point - the user will be interested in what this revision changed + # - including the undoing of previous revisions in the case of + # non-fast-forward updates. echo "" echo "Summary of changes:" - git diff-tree --stat --find-copies-harder $oldrev..$newrev + git diff-tree --stat --summary --find-copies-harder $oldrev..$newrev } # @@ -276,7 +441,8 @@ generate_delete_branch_email() # generate_create_atag_email() { - echo " at $newrev ($newrev_type)" + echo " at $newrev ($newrev_type)" + generate_atag_email } @@ -286,8 +452,9 @@ generate_create_atag_email() # generate_update_atag_email() { - echo " to $newrev ($newrev_type)" - echo " from $oldrev (which is now obsolete)" + echo " to $newrev ($newrev_type)" + echo " from $oldrev (which is now obsolete)" + generate_atag_email } @@ -305,22 +472,25 @@ generate_atag_email() tagged=%(taggerdate)' $refname ) - echo " tagging $tagobject ($tagtype)" + echo " tagging $tagobject ($tagtype)" case "$tagtype" in commit) + # If the tagged object is a commit, then we assume this is a - # release, and so we calculate which tag this tag is replacing + # release, and so we calculate which tag this tag is + # replacing prevtag=$(git describe --abbrev=0 $newrev^ 2>/dev/null) + if [ -n "$prevtag" ]; then - echo " replaces $prevtag" + echo " replaces $prevtag" fi ;; *) - echo " length $(git cat-file -s $tagobject) bytes" + echo " length $(git cat-file -s $tagobject) bytes" ;; esac - echo " tagged by $tagger" - echo " on $tagged" + echo " tagged by $tagger" + echo " on $tagged" echo "" echo $LOGBEGIN @@ -357,7 +527,7 @@ generate_atag_email() # generate_delete_atag_email() { - echo " was $oldrev ($oldrev_type)" + echo " was $oldrev" echo "" echo $LOGEND git show -s --pretty=oneline $oldrev @@ -370,27 +540,29 @@ generate_delete_atag_email() # Called when any other type of reference is created (most likely a # non-annotated tag) # -generate_create_ltag_email() +generate_create_general_email() { - echo " at $newrev ($newrev_type)" - generate_ltag_email + echo " at $newrev ($newrev_type)" + + generate_general_email } # # Called when any other type of reference is updated (most likely a # non-annotated tag) # -generate_update_ltag_email() +generate_update_general_email() { - echo " to $newrev ($newrev_type)" - echo " from $oldrev ($oldrev_type)" - generate_ltag_email + echo " to $newrev ($newrev_type)" + echo " from $oldrev" + + generate_general_email } # # Called for creation or update of any other type of reference # -generate_ltag_email() +generate_general_email() { # Unannotated tags are more about marking a point than releasing a # version; therefore we don't do the shortlog summary that we do for @@ -418,21 +590,62 @@ generate_ltag_email() # # Called for the deletion of any other type of reference # -generate_delete_ltag_email() +generate_delete_general_email() { - echo " was $oldrev ($oldrev_type)" + echo " was $oldrev" echo "" echo $LOGEND git show -s --pretty=oneline $oldrev echo $LOGEND } + +# --------------- Miscellaneous utilities + +# +# Show new revisions as the user would like to see them in the email. +# +show_new_revisions() +{ + # This shows all log entries that are not already covered by + # another ref - i.e. commits that are now accessible from this + # ref that were previously not accessible + # (see generate_update_branch_email for the explanation of this + # command) + + # Revision range passed to rev-list differs for new vs. updated + # branches. + if [ "$change_type" = create ] + then + # Show all revisions exclusive to this (new) branch. + revspec=$newrev + else + # Branch update; show revisions not part of $oldrev. + revspec=$oldrev..$newrev + fi + + other_branches=$(git for-each-ref --format='%(refname)' refs/heads/ | + grep -F -v $refname) + git rev-parse --not $other_branches | + if [ -z "$custom_showrev" ] + then + git rev-list --pretty --stdin $revspec + else + git rev-list --stdin $revspec | + while read onerev + do + eval $(printf "$custom_showrev" $onerev) + done + fi +} + + send_mail() { - if [ -n "$envelopesender" ] ; then - $sendmail -t -f "$envelopesender" + if [ -n "$envelopesender" ]; then + /usr/sbin/sendmail -t -f "$envelopesender" else - $sendmail -t + /usr/sbin/sendmail -t fi } @@ -443,7 +656,8 @@ LOGBEGIN="- Log ---------------------------------------------------------------- LOGEND="-----------------------------------------------------------------------" # --- Config -# Set GIT_DIR either from the working directory or the environment variable. +# Set GIT_DIR either from the working directory, or from the environment +# variable. GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) if [ -z "$GIT_DIR" ]; then echo >&2 "fatal: post-receive: GIT_DIR not set" @@ -451,17 +665,18 @@ if [ -z "$GIT_DIR" ]; then fi projectdesc=$(sed -ne '1p' "$GIT_DIR/description") -# Shorten the description if it's the default -if expr "$projectdesc" : "Unnamed repository.*$" >/dev/null ; then - projectdesc="UNNAMED" +# Check if the description is unchanged from it's default, and shorten it to +# a more manageable length if it is +if expr "$projectdesc" : "Unnamed repository.*$" >/dev/null +then + projectdesc="UNNAMED PROJECT" fi -recipients=$(git config hooks.post-receive-email.mailinglist) -announcerecipients=$(git config hooks.post-receive-email.announcelist) -envelopesender=$(git config hooks.post-receive-email.envelopesender) -emailprefix="[$projectdesc]" -debug=$(git config hooks.post-receive-email.debug) -sendmail=$(git config hooks.post-receive-email.sendmail) +recipients=$(git config hooks.mailinglist) +announcerecipients=$(git config hooks.announcelist) +envelopesender=$(git config hooks.envelopesender) +emailprefix=$(git config hooks.emailprefix || echo '[SCM] ') +custom_showrev=$(git config hooks.showrev) # --- Main loop # Allow dual mode: run from the command line just like the update hook, or @@ -470,15 +685,11 @@ if [ -n "$1" -a -n "$2" -a -n "$3" ]; then # Output to the terminal in command line mode - if someone wanted to # resend an email; they could redirect the output to sendmail # themselves - PAGER= generate_email $2 $3 $1 + #PAGER= generate_email $1 $2 $3 + generate_email $1 $2 $3 | send_mail else while read oldrev newrev refname do - if [ "$debug" == "true" ] ; then - generate_email $oldrev $newrev $refname > "${refname//\//.}.out" - else - generate_email $oldrev $newrev $refname | send_mail - fi + generate_email $oldrev $newrev $refname | send_mail done fi - diff --git a/server/post-receive-hudson b/server/post-receive-hudson index c0439eb..032712b 100755 --- a/server/post-receive-hudson +++ b/server/post-receive-hudson @@ -35,7 +35,32 @@ # hudson() { - + + # --- Interpret + # 0000->1234 (create) + # 1234->2345 (update) + # 2345->0000 (delete) + if expr "$1" : '0*$' >/dev/null + then + change_type="create" + else + if expr "$2" : '0*$' >/dev/null + then + change_type="delete" + else + change_type="update" + fi + fi + + case "$change_type" in + create|update) + + ;; + delete) + exit 0 + ;; + esac + case "$3" in refs/tags/*) exit 0 @@ -80,7 +105,7 @@ hudson() # Create the job stable_config=$(wget -O - $hudson_url/job/${jobParent}/config.xml 2>/dev/null) if [ $? -ne 0 ] ; then - display_error_message "Could not get existing Hudson config for ${short_refname} at url ${hudson_url}" + display_error_message "Could not get existing Hudson config from job ${jobParent} for ${short_refname} at url ${hudson_url}" exit 0 fi @@ -107,7 +132,6 @@ hudson() wget --header "Content-Type: text/xml" --post-data="$branch_config" -O - "$jobUrl/config.xml" >/dev/null 2>/dev/null if [ $? -ne 0 ] ; then display_error_message "Could not add $USER_EMAIL to recipients list for Hudson job ${short_refname}" - exit 0 fi fi