You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by db...@apache.org on 2005/07/26 05:27:06 UTC
svn commit: r225224 - /geronimo/scripts/build_and_complain.sh
Author: dblevins
Date: Mon Jul 25 20:27:04 2005
New Revision: 225224
URL: http://svn.apache.org/viewcvs?rev=225224&view=rev
Log:
Script similar to the one that created huge emails
Added:
geronimo/scripts/build_and_complain.sh (with props)
Added: geronimo/scripts/build_and_complain.sh
URL: http://svn.apache.org/viewcvs/geronimo/scripts/build_and_complain.sh?rev=225224&view=auto
==============================================================================
--- geronimo/scripts/build_and_complain.sh (added)
+++ geronimo/scripts/build_and_complain.sh Mon Jul 25 20:27:04 2005
@@ -0,0 +1,187 @@
+#!/usr/local/bin/bash
+#
+# Copyright 2005 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# --------------------------------------------------------------------
+# $Rev$ $Date$
+# --------------------------------------------------------------------
+
+# HOW TO USE THIS SCRIPT
+#
+# Executing the script like the following will run the build and, in
+# the event of a failure, send an email message to
+# scm@geronimo.apache.org with a link to the build output and a small
+# snippit of maven output.
+#
+# $ ./build_and_complain.sh
+#
+# Executing the script like the following will do the same as above,
+# but send the build output to foobar@apache.org
+#
+# $ ./build_and_complain.sh foobar@apache.org
+#
+# DETAILS
+#
+# On failure, the script will scp build data to your public_html
+# directory on people.apache.org. If your keys aren't setup, this
+# won't work so well.
+#
+# Email messages are send with mutt, which could be improved to be
+# something usually installed on a typical machine.
+#
+# The email address for nagging emails can be a parameter
+
+############################################################
+#
+# Parameters
+#
+############################################################
+
+# The email address to complain to
+SCM_LIST=${1:-scm@geronimo.apache.org}
+
+# The list of modules we will build
+MODULES=$(ls geronimo/{applications,specs,plugins,modules}/*/project.xml openejb/modules/*/project.xml tranql{,-connector}/project.xml | tr '\n' ',')
+
+############################################################
+#
+# Functions
+#
+############################################################
+
+#----
+# Checkout the projects needed if not already checked out
+#
+function setup {
+ [ ! -d geronimo ] && svn co http://svn.apache.org/repos/asf/geronimo/trunk geronimo
+ [ ! -d openejb ] && cvs -d:pserver:anon@cvs.openejb.org:/scm/openejb co openejb
+ [ ! -d tranql ] && cvs -d:pserver:anon@cvs.tranql.codehaus.org:/scm/tranql co tranql
+ [ ! -d tranql-connector ] && cvs -d:pserver:anon@cvs.tranql.codehaus.org:/scm/tranql co -d tranql-connector connector
+}
+
+#----
+# Don't kill the build on failing tests. Run it all the
+# way through and report all the failing tests at the end.
+#
+function xmaven {
+ LOG=/tmp/$USER-$(date +%s)
+ maven -Dmaven.test.failure.ignore=true 2>&1 "$@" | tee $LOG
+
+ if [ -n "$(grep 'FAILED$' $LOG)" ] ; then
+ rm $LOG
+ return 1
+ fi
+ rm $LOG
+}
+
+#----
+# Grep the maven output and generate failure information
+# if the build or tests failed. Don't send a big email,
+# just scp the files to people.apache.org/~you and put
+# a link in the email
+#
+function monitorlog {
+ BUILD_ID=${1?You must specify a build id}
+ LOG=${2?You must specify a log name}
+ TO=${3:-scm@geronimo.apache.org}
+
+ # If the build didn't fail, just exit
+ if [ -z "$(grep 'FAILED$' $LOG)" ] ; then
+ return 1
+ fi
+
+ mkdir /tmp/$BUILD_ID
+ cp $LOG /tmp/$BUILD_ID/build-output.txt
+
+ for n in $(grep "junit.*FAILED" $LOG | perl -pe 's/.*TEST (.*) FAILED/$1/'); do
+ JUNIT_REPORT=$(find . -name "TEST-$name.txt" -exec ls $PWD/{} \;)
+ cp $JUNIT_REPORT /tmp/$BUILD_ID/
+ done
+
+ maven --info > /tmp/$BUILD_ID/maven-info.txt
+ uname -a > /tmp/$BUILD_ID/system-info.txt
+
+ scp -C -r /tmp/$BUILD_ID people.apache.org:public_html/
+
+ # Everything from EOF ...(many lines)... EOF is the email,
+ # so if you want to change the output, this is where.
+
+### begin email output ###
+ mutt -xs "build failed $(date)" $TO <<EOF
+BUILD FAILED
+
+See details at:
+
+ http://people.apache.org/~$USER/$BUILD_ID
+
+Simple grep of build output:
+
+$(grep -C 10 FAILED $LOG | perl -pe 's/^--$/\n[SNIP]\n/; s/^/ /')
+
+--
+Feel welcome to set this script [1] up on your machine and direct the
+messages to scm AT geronimo.apache.org. Also feel free to send
+patches to our jira [2] if you would like different/better output or
+command line options.
+
+ 1. http://svn.apache.org/repos/asf/geronimo/scripts/build_and_complain.sh
+ 2. http://issues.apache.org/jira/browse/GERONIMO
+
+EOF
+### end email output ###
+
+ rm -r /tmp/$BUILD_ID
+}
+
+############################################################
+#
+# M A I N
+#
+############################################################
+
+
+# run the setup function
+setup
+
+# do a clean of the build directories
+maven -o -Dmaven.multiproject.includes=$MODULES -Dgoal=clean multiproject:goal
+
+# make up a somewhat unique build id
+BUILD_ID=build-$(date +%Y%m%d-%H%M)
+
+# update all the source code
+{
+ echo "Updating code"
+ (cd geronimo && svn update) &&
+ (cd openejb && cvs -q up -dP) &&
+ (cd tranql && cvs -q up -dP) &&
+ (cd tranql-connector && cvs -q up -dP)
+} 2>&1 | tee scm-log.txt
+
+# run the build
+LOG=$BUILD_ID-output.txt
+{
+ echo "Building $MODULES"
+ xmaven -Dmaven.multiproject.includes=$MODULES -Dgoal=default multiproject:goal
+} 2>&1 | tee $LOG
+
+# check the log file and complain if needed
+monitorlog $BUILD_ID $LOG $SCM_LIST
+
+# kill our log file
+rm $LOG
+
+
+
Propchange: geronimo/scripts/build_and_complain.sh
------------------------------------------------------------------------------
svn:executable = *
Build failure emails -- Re: svn commit: r225224 - /geronimo/scripts/build_and_complain.sh
Posted by David Blevins <da...@visi.com>.
I've revised my build script and am very much hoping some other people
will bite on this one and install it and/or fix it up.
HOW TO USE THIS SCRIPT
Executing the script like the following will run the build and, in
the event of a failure, send an email message to
scm@geronimo.apache.org with a link to the build output and a small
snippit of maven output.
$ ./build_and_complain.sh
Executing the script like the following will do the same as above,
but send the build output to foobar@apache.org
$ ./build_and_complain.sh foobar@apache.org
DETAILS
On failure, the script will scp build data to your public_html
directory on people.apache.org. If your keys aren't setup, this
won't work so well.
Email messages are send with mutt, which could be improved to be
something usually installed on a typical machine.
Thanks,
David
On Tue, Jul 26, 2005 at 03:27:06AM -0000, dblevins@apache.org wrote:
> Author: dblevins
> Date: Mon Jul 25 20:27:04 2005
> New Revision: 225224
>
> URL: http://svn.apache.org/viewcvs?rev=225224&view=rev
> Log:
> Script similar to the one that created huge emails
>
> Added:
> geronimo/scripts/build_and_complain.sh (with props)
>
> Added: geronimo/scripts/build_and_complain.sh
> URL: http://svn.apache.org/viewcvs/geronimo/scripts/build_and_complain.sh?rev=225224&view=auto