mirror of https://github.com/apache/maven.git
update CI script to work for branch and trunk
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@358197 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
010fa18eb5
commit
f4fc13c1b0
76
ci.sh
76
ci.sh
|
@ -9,6 +9,10 @@ CMD=$1
|
|||
|
||||
[ "$1" = "" ] && echo && echo "You must specify a checkout or update!" && echo && exit 1
|
||||
|
||||
BRANCH="branches/${2}"
|
||||
|
||||
[ "$2" = "" ] BRANCH="trunk"
|
||||
|
||||
FROM=continuum@maven.zones.apache.org
|
||||
TO=dev@maven.apache.org
|
||||
DATE=`date`
|
||||
|
@ -19,7 +23,7 @@ if [ ! -z "$RUNNING" ]; then
|
|||
if [ "$CMD" = "checkout" ]; then
|
||||
echo "From: $FROM" > running_log
|
||||
echo "To: $TO" >> running_log
|
||||
echo "Subject: [maven2 build - SKIPPED - $CMD] $DATE" >>running_log
|
||||
echo "Subject: [maven2 build $BRANCH - SKIPPED - $CMD] $DATE" >>running_log
|
||||
echo "" >> running_log
|
||||
echo "ci.sh already running... exiting" >>running_log
|
||||
echo "$RUNNING" >>running_log
|
||||
|
@ -28,24 +32,24 @@ if [ ! -z "$RUNNING" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
HOME_DIR=`pwd`
|
||||
DIR=$HOME/m2-build
|
||||
REPO=$HOME_DIR/maven-repo-local
|
||||
SCM_LOG=scm.log
|
||||
DIR=$HOME/m2-build/$BRANCH
|
||||
mkdir -p $DIR
|
||||
|
||||
REPO=$DIR/maven-repo-local
|
||||
|
||||
SCM_LOG=$DIR/scm.log
|
||||
BUILD_REQUIRED_FILE=$DIR/build_required
|
||||
|
||||
TIMESTAMP=`date +%Y%m%d.%H%M%S`
|
||||
WWW=$HOME/public_html
|
||||
DEPLOY_DIR=$WWW/builds
|
||||
DEPLOY_SITE=http://maven.zones.apache.org/~maven/builds
|
||||
DEPLOY_DIR=$WWW/builds/$BRANCH
|
||||
DEPLOY_SITE=http://maven.zones.apache.org/~maven/builds/$BRANCH
|
||||
DIST=m2-${TIMESTAMP}.tar.gz
|
||||
SVN=svn
|
||||
|
||||
M2_HOME=$DIR/maven-2.1-SNAPSHOT
|
||||
export M2_HOME
|
||||
PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin
|
||||
export PATH
|
||||
|
||||
MESSAGE_DIR=$WWW/logs
|
||||
MESSAGE_DIR=$WWW/logs/$BRANCH
|
||||
MESSAGE_NAME=m2-build-log-${TIMESTAMP}.txt
|
||||
MESSAGE_SITE=http://maven.zones.apache.org/~maven/logs/$BRANCH
|
||||
MESSAGE=${MESSAGE_DIR}/${MESSAGE_NAME}
|
||||
|
||||
mkdir -p $DEPLOY_DIR
|
||||
|
@ -59,14 +63,18 @@ mkdir -p $MESSAGE_DIR
|
|||
# ----------------------------------------------------------------------------------
|
||||
|
||||
BUILD_REQUIRED=false
|
||||
if [ -f $HOME_DIR/build_required ]; then
|
||||
BUILD_REQUIRED=`cat $HOME_DIR/build_required`
|
||||
if [ -f $BUILD_REQUIRED_FILE ]; then
|
||||
BUILD_REQUIRED=`cat $BUILD_REQUIRED_FILE`
|
||||
fi
|
||||
|
||||
if [ ! -d $DIR/maven-components ]; then
|
||||
CMD="checkout"
|
||||
fi
|
||||
|
||||
if [ ! -d $DIR/plugins ]; then
|
||||
CMD="checkout"
|
||||
fi
|
||||
|
||||
(
|
||||
if [ "$CMD" = "checkout" ]
|
||||
then
|
||||
|
@ -86,10 +94,10 @@ fi
|
|||
(
|
||||
cd $DIR
|
||||
|
||||
$SVN co http://svn.apache.org/repos/asf/maven/components/trunk maven-components > $HOME_DIR/$SCM_LOG 2>&1
|
||||
$SVN co http://svn.apache.org/repos/asf/maven/plugins/trunk plugins > $HOME_DIR/$SCM_LOG 2>&1
|
||||
$SVN co http://svn.apache.org/repos/asf/maven/components/$BRANCH maven-components > $SCM_LOG 2>&1
|
||||
$SVN co http://svn.apache.org/repos/asf/maven/plugins/trunk plugins > $SCM_LOG 2>&1
|
||||
|
||||
echo "true" > $HOME_DIR/build_required
|
||||
echo "true" > $BUILD_REQUIRED_FILE
|
||||
)
|
||||
|
||||
else
|
||||
|
@ -101,22 +109,22 @@ fi
|
|||
(
|
||||
cd $DIR/maven-components
|
||||
|
||||
$SVN update > $HOME_DIR/$SCM_LOG 2>&1
|
||||
$SVN update > $SCM_LOG 2>&1
|
||||
|
||||
cd $DIR/plugins
|
||||
|
||||
$SVN update >> $HOME_DIR/$SCM_LOG 2>&1
|
||||
$SVN update >> $SCM_LOG 2>&1
|
||||
|
||||
grep "^[PUAD] " $HOME_DIR/$SCM_LOG > /dev/null 2>&1
|
||||
grep "^[PUAD] " $SCM_LOG > /dev/null 2>&1
|
||||
|
||||
if [ "$?" = "1" ]
|
||||
then
|
||||
|
||||
echo $BUILD_REQUIRED > $HOME_DIR/build_required
|
||||
echo $BUILD_REQUIRED > $BUILD_REQUIRED_FILE
|
||||
|
||||
else
|
||||
|
||||
echo "true" > $HOME_DIR/build_required
|
||||
echo "true" > $BUILD_REQUIRED_FILE
|
||||
|
||||
fi
|
||||
|
||||
|
@ -124,16 +132,23 @@ fi
|
|||
|
||||
fi
|
||||
|
||||
BUILD_REQUIRED=`cat $HOME_DIR/build_required`
|
||||
BUILD_REQUIRED=`cat $BUILD_REQUIRED_FILE`
|
||||
|
||||
if [ "$BUILD_REQUIRED" = "true" ]
|
||||
then
|
||||
|
||||
echo "Updates occured, build required ..."
|
||||
echo
|
||||
grep "^[PUAD] " $HOME_DIR/$SCM_LOG
|
||||
grep "^[PUAD] " $SCM_LOG
|
||||
echo
|
||||
|
||||
version=`cat $DIR/maven-components/pom.xml | tr '\n' ' ' | sed 's#<parent>.*</parent>##g' | sed 's#<dependencies>.*</dependencies>##g' | sed 's#<build>.*</build>##g' | sed 's#^.*<version>##g' | sed 's#</version>.*$##g'`
|
||||
|
||||
M2_HOME=$DIR/maven-$version
|
||||
export M2_HOME
|
||||
PATH=$JAVA_HOME/bin:$M2_HOME/bin:$PATH
|
||||
export PATH
|
||||
|
||||
(
|
||||
cd $DIR/maven-components
|
||||
|
||||
|
@ -161,7 +176,7 @@ fi
|
|||
) >> $MESSAGE 2>&1
|
||||
ret=$?
|
||||
|
||||
BUILD_REQUIRED=`cat $HOME_DIR/build_required`
|
||||
BUILD_REQUIRED=`cat $BUILD_REQUIRED_FILE`
|
||||
|
||||
# Only send mail to the list if a build was required.
|
||||
|
||||
|
@ -172,17 +187,18 @@ then
|
|||
echo "From: $FROM" > log
|
||||
echo "To: $TO" >> log
|
||||
if [ $ret != 0 ]; then
|
||||
echo "Subject: [maven2 build - FAILED - $CMD] $DATE" >> log
|
||||
echo "Subject: [maven2 build $BRANCH - FAILED - $CMD] $DATE" >> log
|
||||
else
|
||||
echo "Subject: [maven2 build - SUCCESS - $CMD] $DATE" >> log
|
||||
echo "Subject: [maven2 build $BRANCH - SUCCESS - $CMD] $DATE" >> log
|
||||
echo "" >> log
|
||||
echo "Distribution:" >> log
|
||||
echo "${DEPLOY_SITE}/${DIST}" >>log
|
||||
rm $HOME_DIR/build_required
|
||||
rm $BUILD_REQUIRED_FILE
|
||||
fi
|
||||
echo "" >> log
|
||||
echo "Log:" >> log
|
||||
echo "http://maven.zones.apache.org/~maven/logs/${MESSAGE_NAME}" >> log
|
||||
echo "${MESSAGE_SITE}/${MESSAGE_NAME}" >> log
|
||||
|
||||
/usr/sbin/sendmail -t < log
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue