• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cruise control giving wrong status in email.

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using cruise control for my continuos builds. Here is my problem.
This is the content of the buildfile that gets called from config.xml of the cruise control.

<project name="projectNJ" default="build" basedir="F:\NJ4.5\projectNJdev">
<target name="build">

<cvs command="-q update -d -P -A -C -R"/>
<exec dir="." executable="cmd" os="Windows XP">
<arg line="/c buildall.bat RESET_DATABASE_BUILD RELEASE_BUILD"/>
</exec>
</target>
</project>


In my buildall.bat file I have calls to many xml files which needs to be executed.
e.g
oResetDatabaseLite
if "%RESET_DATABASE_BUILD%" == "true" goto doResetDatabase
echo dblite on EJBServer
call build.bat dblite >> %PROJ_DIR%/buildall.log
if errorlevel==1 goto BUILD_FAILED

:BUILD_SUCCESS
echo .
echo Build Successfully Completed
echo . >> %PROJ_DIR%/buildall.log
echo Build Successfully Completed >> %PROJ_DIR%/buildall.log
goto end

:BUILD_FAILED
echo .
echo Build Failed - See errors
echo . >> %PROJ_DIR%/buildall.log
echo Build Failed - See errors >> %PROJ_DIR%/buildall.log
goto end

:End
cd %PROJ_DIR%
echo .
echo Build Over
echo . >> %PROJ_DIR%/buildall.log
echo Build Over >> %PROJ_DIR%/buildall.log


Here even if "build.bat dblite" call fails, My cruise control sends out a mail saying that "the build is successful" . Can you please suggest me what is that I am doing wrong or how to make the cruise control give me the correct message.

Please help

- Roshan
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cruise Control is ultimately just Ant, and Ant can be a little less than predictable when using exec tasks (not that they wont run, but that Ant might have no visibility their output, depending on what he executable does). My guess is that Cruise Control is successfully calling buildall.bat, which is successfully running your script though it is going to the BUILD_FAILED block. If you use a batch file to perform your build you will need to use the errorstr of the exec task to let Cruise Control find out that the build failed.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Sturrock:
Cruise Control is ultimately just Ant



Sorry, no, not at all. The only connection between CC and Ant is that CC is able to call Ant to execute Ant scripts.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My mistake. You are of course right Ilja - I shouldn't believe everything I read without checking! The problem should still be fixable by using the errorstr attribute though.
 
Roshan Kurian
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thank you very much for the information But what happened is

I tried <exec dir="." executable="cmd" os="Windows XP" errorstr="Build Failed">

in my build file. But my build failed completly saying
--
The <exec> type doesn't support the "errorstr" attribute.
--

I couldn't put The exec part into my schedule of config.xml as it is having a reference as following

<ant anthome="F:\apache-ant-1.6.2"
buildfile="projectNJ.xml"
target="build"
uselogger="true"
usedebug="true"/>

which in turn had the reference to buildall.bat.(The code I am using for this is mentioned in my question which I posted in the beginning.)

-----

I have now added exit /b 1 as a part of my BUILD_FAILED. Can this abnormal exit on failure be used in CC in any way?

--------------------
:BUILD_FAILED
echo .
echo Build Failed - See errors
echo . >> %CURAM_DIR%/buildall.log
echo Build Failed - See errors >> %CURAM_DIR%/buildall.log
exit /b 1
goto end
--------------------

- Roshan
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I tried <exec dir="." executable="cmd" os="Windows XP" errorstr="Build Failed">

in my build file.




I couldn't put The exec part into my schedule of config.xml as it is having a reference as following
<ant anthome="F:\apache-ant-1.6.2"
buildfile="projectNJ.xml"
target="build"
uselogger="true"
usedebug="true"/>



Now I'm confused. Are you executing this batch file form an Ant build file, or CruiseControl? CruseControl's documentation mention this attribute.
[ December 20, 2006: Message edited by: Paul Sturrock ]
 
Roshan Kurian
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am executing this batch file from an Ant build file which is being called from the schedule of config.xml of Cruise control.

Here is the schedule part code that i am using

<schedule interval="1">
<ant anthome="F:\apache-ant-1.6.2"
buildfile="projectNJ.xml"
target="build"
uselogger="true"
usedebug="true"/>
</schedule>


and the code inside the projectNJ.xml is as following

<project name="projectNJ" default="build" basedir="F:\NJ4.5\projectNJdev">
<target name="build">

<cvs command="-q update -d -P -A -C -R"/>
<exec dir="." executable="cmd" os="Windows XP">
<arg line="/c buildall.bat RESET_DATABASE_BUILD RELEASE_BUILD"/>
</exec>
</target>
</project>


I hope now my question is clear. Sorry for the confusion.

-Roshan
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah - so your problem is that Ant doesn't know that your batch file running the BUILD_FAILED block == the build failed, since all it cares about is that your batch file was run without error. So you need to manually find a way to let Ant know the result of the batch script. You might be able to do something with the Ant exec task's outputproperty attribute.
[ December 20, 2006: Message edited by: Paul Sturrock ]
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The most elegant way would be to have the batch file exit with an exit code != 0. Don't know how to do that, tough - if it's possible at all. Perhaps the "exit" command accepts a parameter?

If you have are able to do that, you only need to add failonerror attribute to the Ant task.
 
Not so fast naughty spawn! I want you to know about
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic