3 . $(dirname $0)/functions
5 while read oldrev newrev refname ; do
11 short_refname=${refname##refs/heads/}
14 echo >&2 "*** Unknown type of update to $refname"
19 branch_config=$(wget -O - http://cbas1:8080/hudson/job/${short_refname}/config.xml 2>/dev/null)
20 if [ $? -ne 0 ] ; then
22 stable_config=$(wget -O - http://cbas1:8080/hudson/job/stable/config.xml 2>/dev/null)
23 if [ $? -ne 0 ] ; then
24 display_error_message "Could not get existing Hudson config for ${short_refname}"
28 branch_config="${stable_config/<branch>stable</<branch>$short_refname<}"
30 if [ "${branch_config/$USER_EMAIL/}" == "$branch_config" ] ; then
31 branch_config="${branch_config/<recipients>/<recipients>$USER_EMAIL }"
34 echo "$branch_config" > branch_config.txt
36 # wget "http://cbas1:8080/hudson/createItem?name=${short_refname}&mode=copyJob&from=stable" > wget.txt
37 wget --header "Content-Type: text/xml" --post-data="$branch_config" -O - "http://cbas1:8080/hudson/createItem?name=${short_refname}" >/dev/null 2>/dev/null
38 if [ $? -ne 0 ] ; then
39 display_error_message "Could not create new Hudson job for ${short_refname}"
43 # Add email to recipients list
44 if [ "${branch_config/$USER_EMAIL/}" == "$branch_config" ] ; then
45 branch_config="${branch_config/<recipients>/<recipients>$USER_EMAIL }"
47 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
48 if [ $? -ne 0 ] ; then
49 display_error_message "Could not add $USER_EMAIL to Hudson job ${short_refname}"