On Mon, Nov 21, 2011 at 06:04:45PM +0100, Thorsten Behrens wrote: > Lionel Elie Mamane wrote:
>> 2) I'd like to get an explicit "tinderbox success" email IF AND ONLY >> IF the last mail I got from that tinderbox is "tinderbox failure". >> Or if people would mind that, maybe get "tinderbox success" IF AND >> ONLY IF one's commit is in the commits since last failure? > See > http://cgit.freedesktop.org/libreoffice/contrib/buildbot/tree/bin/tinbuild2 > for what most boxes run - that needs fixing there, would be cool if > you could have a look. The attached 0001-* patch should implement the following: When transitioning from failure to success, email all committers since previous success. Compared to my request quoted above, this also gets in the loop the committer of the fix. It uselessly spams people that committed since last failure and did not fix the build (but did an unrelated change), but I think the service to the committer of the fix is worth that. As I don't have a tinderbox, the patch is untested, obviously. The attached 0002-* patch implements another change I think is relevant: on failure (and the above failure-success transition), email authors as well as committers. After all, the author of the patch may have more clue and/or insight into the problem than the committer. -- Lionel
>From c0c3733d681ac5f73805b9e7105b030c1b117ed3 Mon Sep 17 00:00:00 2001 From: Lionel Elie Mamane <[email protected]> Date: Tue, 13 Dec 2011 05:42:31 +0100 Subject: [PATCH 1/2] mail committers when failed build gets fixed --- bin/tinbuild2 | 4 +- bin/tinbuild_internals.sh | 108 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 107 insertions(+), 5 deletions(-) diff --git a/bin/tinbuild2 b/bin/tinbuild2 index f0aca66..be604ab 100755 --- a/bin/tinbuild2 +++ b/bin/tinbuild2 @@ -30,7 +30,7 @@ FORCE_REBUILD=0 # # The build cycle, invoked in this script with do_build, consist # of 5 phases that are processed in this order: autogen, clean, make, test, push -# eeach phase execution try to invoke pre_<phase>, do_<phase> and post_<pahse> +# each phase execution tries to invoke pre_<phase>, do_<phase> and post_<phase> # in this order, if the respective bash function are defined. # # In order to implement a specific step, pre_build for instance, you need @@ -369,7 +369,7 @@ while true; do if [ "$retval" != "false_negative" ] ; then wait_for_commits else - collect_current_heads + collect_current_heads fi last_checkout_date="$(cat tb_${B}_current-git-timestamp.log)" ( diff --git a/bin/tinbuild_internals.sh b/bin/tinbuild_internals.sh index 0416a09..e1aab01 100644 --- a/bin/tinbuild_internals.sh +++ b/bin/tinbuild_internals.sh @@ -97,6 +97,32 @@ get_commits_since_last_good() fi } +get_commits_since_last_bad() +{ + local mode=$1 + local head= + local repo= + local sha= + + if [ -f tb_${B}_last-failure-git-heads.txt ] ; then + for head in $(cat tb_${B}_last-failure-git-heads.txt) ; do + repo=$(echo ${head} | cut -d : -f 1) + sha=$(echo ${head} | cut -d : -f 2) + ( + if [ "${repo?}" != "bootstrap" -a "${repo}" != "core" ] ; then + cd clone/${repo?} + fi + if [ "${mode?}" = "people" ] ; then + git log '--pretty=tformat:%ce' ${sha?}..HEAD + else + echo "==== ${repo} ====" + git log '--pretty=tformat:%h %s' ${sha?}..HEAD | sed 's/^/ /' + fi + ) + done + fi +} + send_mail_msg() { local to="$1" @@ -190,7 +216,7 @@ report_error () message="box broken" ;; *) if [ -z "$last_success" ] ; then - # we need at least one successful build to + # we need at least one successful build to # be reliable to_mail="${OWNER?}" else @@ -233,6 +259,75 @@ EOF fi } +report_fixed () +{ + local_to_mail= + local tinder1= + local tinder2= + local mail_tail= + local success_kind="$1" + shift + local rough_time="$1" + shift + + local previous_success=$(cat tb_${B}_last-success-git-timestamp.txt) + local last_failure=$(cat tb_${B}_last-failure-git-timestamp.txt) + to_mail= + if [ "$SEND_MAIL" = "owner" -o "$SEND_MAIL" = "debug" -o "$SEND_MAIL" = "author" ] ; then + to_mail="${OWNER?}" + else + if [ "$SEND_MAIL" = "all" ] ; then + case "$success_kind" in + owner) to_mail="${OWNER?}" + message="box fixed" ;; + *) + if [ -z "$previous_success" ] ; then + # we need at least one successful build to + # be reliable + to_mail="${OWNER?}" + else + to_mail="$(get_committers)" + fi + message="previous success: ${previous_success?}" ;; + esac + fi + fi + if [ -n "$to_mail" ] ; then + echo "$*" 1>&2 + echo "Previous success: ${previous_success}" 1>&2 + echo "Last failure: ${last_failure}" 1>&2 + tinder1="`echo \"Full log available at http://tinderbox.libreoffice.org/$TINDER_BRANCH/status.html\"`" + tinder2="`echo \"Box name: ${TINDER_NAME?}\"`" + if [ "$*" != "" ]; then + mail_tail = $'\nAdditional information:\n\n'"$*" + fi + + cat <<EOF | send_mail_msg "$to_mail" "Tinderbox fixed, $message" "" "${OWNER?}" "" +Hi folks, + +The previously reported build failure is fixed. Thanks! + +${tinder1} + +Tinderbox info: + + ${tinder2} + Machine: `uname -a` + Configured with: `cat autogen.lastrun` + +Commits since last failure: + +$(get_commits_since_last_bad commits) + +Commits since the previous success: + +$(get_commits_since_last_good commits) +${mail_tail} +EOF + else + echo "$*" 1>&2 + fi +} collect_current_heads() { @@ -242,7 +337,7 @@ collect_current_heads() get_committers() { - echo "get_commiter: $(get_commits_since_last_good people)" 1>&2 + echo "get_committers: $(get_commits_since_last_good people)" 1>&2 get_commits_since_last_good people | sort | uniq | tr '\n' ',' } @@ -251,6 +346,9 @@ rotate_logs() if [ "$retval" = "0" ] ; then cp -f tb_${B}_current-git-heads.log tb_${B}_last-success-git-heads.txt 2>/dev/null cp -f tb_${B}_current-git-timestamp.log tb_${B}_last-success-git-timestamp.txt 2>/dev/null + elif [ "$retval" != "false_negative" ]; then + cp -f tb_${B}_current-git-heads.log tb_${B}_last-failure-git-heads.txt 2>/dev/null + cp -f tb_${B}_current-git-timestamp.log tb_${B}_last-failure-git-timestamp.txt 2>/dev/null fi for f in tb_${B}*.log ; do mv -f ${f} prev-${f} 2>/dev/null @@ -323,6 +421,7 @@ do_build() report_to_tinderbox "${last_checkout_date?}" "building" "no" fi + previous_build_status="${build_status}" build_status="build_failed" retval=0 retry_count=3 @@ -338,8 +437,11 @@ do_build() build_status="success" if [ -n "${last_checkout_date}" ] ; then report_to_tinderbox "$last_checkout_date" "success" "yes" + if [ "${previous_build_status}" = "build_failed" ]; then + report_fixed committer "$last_checkout_date" + fi else - log_msgs "Successfuly primed branch '$TINDER_BRANCH'." + log_msgs "Successfully primed branch '$TINDER_BRANCH'." fi elif [ "$retval" = "false_negative" ] ; then report_to_tinderbox "${last_checkout_date?}" "fold" "no" -- 1.7.7.3
>From 2db8a4d8e6d753dc8a0e3539c12eef6a66a9d1c6 Mon Sep 17 00:00:00 2001 From: Lionel Elie Mamane <[email protected]> Date: Tue, 13 Dec 2011 05:51:33 +0100 Subject: [PATCH 2/2] mail authors as well as committers --- bin/tinbuild_internals.sh | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/tinbuild_internals.sh b/bin/tinbuild_internals.sh index e1aab01..8a9263a 100644 --- a/bin/tinbuild_internals.sh +++ b/bin/tinbuild_internals.sh @@ -87,7 +87,7 @@ get_commits_since_last_good() cd clone/${repo?} fi if [ "${mode?}" = "people" ] ; then - git log '--pretty=tformat:%ce' ${sha?}..HEAD + git log '--pretty=tformat:%ce%n%ae' ${sha?}..HEAD else echo "==== ${repo} ====" git log '--pretty=tformat:%h %s' ${sha?}..HEAD | sed 's/^/ /' @@ -113,7 +113,7 @@ get_commits_since_last_bad() cd clone/${repo?} fi if [ "${mode?}" = "people" ] ; then - git log '--pretty=tformat:%ce' ${sha?}..HEAD + git log '--pretty=tformat:%ce%n%ae' ${sha?}..HEAD else echo "==== ${repo} ====" git log '--pretty=tformat:%h %s' ${sha?}..HEAD | sed 's/^/ /' -- 1.7.7.3
_______________________________________________ LibreOffice mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice
