[Anthill-pro] Mailing the contents of the build log

Ivan "Rambius" Ivanov rambiusparkisanius at gmail.com
Mon Jul 3 17:23:19 CDT 2006


Hello Eric,

Thank you for your help. I found it very helpful and I wrote the
following report template:

## LEAVE THE DEFAULT MIME TYPE
## #set( $mimeType = "text/plain")
##
#set( $buildOwner = $buildDef.getBuildOwner())
##
## BUILD THE SUBJECT
#if ($buildOwner.getBuildTrackName() == "TechChangesNonProd")
    #set( $subject =  "Deploy_Non-PROD ")
#else
    #if ($buildOwner.getBuildTrackName() == "TechChangesProd")
         #set( $subject = "Deploy-PROD ")
    #end
#end
#set( $subject = "$subject IR Report on $buildDef.getBuildDate()")
##
## DEFINE MACROS
#macro ( outputFile file )
    #set ( $start = $fileReaderHelper.startReadingFile($file) )
    #foreach( $logStr in $fileReaderHelper )
        #if ( $logStr )
             $logStr #set ( $logStr = false )
        #end
    #end
    #set ( $stop = $fileReaderHelper.stopReadingFile() )
#end
##
## BUILD THE BODY
## ITERATE THROUGH EACH OF THE BUILDERS AND ADD THEIR LOGS
#foreach( $builder in $buildOwner.getBuilderIterator() )
#outputFile ( $buildDef.getModuleLogFile($builder) )
#end

Now when I adjusted the template I have the following questions:

1) The log file for my builder contains not only the output of my
batch file but also some logs generated by Anthill Pro.

[snippet from Anthill Pro build logs]
BuildId: 27185 of CQReports.TechChanges.TechChangesNonProd running on
AnthillPro (2.6.1.19123) licensed to ******
Writer: Intranet Publisher

INFO - Explicity set environment variables:
INFO - Execute:Java13CommandLauncher: Executing 'cmd' with arguments:
'/x/c'
'C:\opt\reports\TechnicalChangesReports\findTechChanges.bat'
'nonprod'
........
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\buildadm\Application Data
<environment variables go here>
......
[end of snippet from Anthill Pro build logs]

After this, the ouptut of my batch file comes, each line prefixed with
INFO string:

[snippet from Anthill Pro build logs]
INFO - The batch file started
....
[end of snippet from Anthill Pro build logs]

My first question is how I can set up Anthill Pro to include in the
builder log only the output of my batch file with no debug logs from
itself and how I can set it up to not put "INFO" in the beginning of
each line.

2) I took a closer look and the macro outputFile. Can it be used for
dumping the contents of a random file? I tried to but with no success.
Here is my template:

#set ( $repositoryDriver = $buildOwner.getRepositoryDriver() )
#set ( $localWorkDir = $repositoryDriver.getLocalWorkDirectory($buildDef))
#set ( $reportFileName = "$localWorkDir\report.log")
#outputFile ($reportFileName)

It simply outputs nothing. I believe this is because $reportFileName
is String and the macro outputFile expects a file.

Thank you very much for your useful and quick help once again

Regards
Ivan

On 7/3/06, Eric Minick <etm at urbancode.com> wrote:
> Ivan,
>
> That's quite doable and if that shell script build is the only builder
> on the build track, it's very easy. There's an example of this in the
> "complete" example template.
>
> The interesting part is:
>
>
> ## ITERATE THROUGH EACH OF THE BUILDERS AND ADD THEIR LOGS
> #foreach( $builder in $buildOwner.getBuilderIterator() )
> $builder.getName() Log:
> #outputFile ( $buildDef.getModuleLogFile($builder) )
>
> That will roll through each of the builders and append the log files for
> each in turn. There's a similar section in the complete - html template
> which is more attractive, but this is the simplist case.
>
> -- Eric
>
> Ivan "Rambius" Ivanov wrote:
>
> > Hello,
> >
> > I have a build track and it has a shell builder called nonprod_report
> > that runs a small batch file. When the builder is run, the output of
> > the script is dumped into a log file called
> > anthill_nonprod_report_log.txt. My question is: is it possible to send
> > the contents of this log file as the body of the notification email. I
> > suppose it is possible and if so can you give me some help in
> > adjusting the report templates.
> >
> > Regards
> > Ivan
> >
>
> _______________________________________________
> Anthill-pro mailing list
> Anthill-pro at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/anthill-pro
>


-- 
Tangra Mega Rock: http://www.radiotangra.com


More information about the Anthill-pro mailing list