It's all about the answers!

Ask a question

How to customize the build notification email to contain the build number?


Qunfeng Wang (421710) | asked May 21 '13, 3:10 a.m.
We doesn't store the build artifacts in RTC. So the RTC won't know the build number. There is a place, the Ant build script, RTC has a chance to get the build number there. What I'd like to do is pass the the build number to RTC and display it in the build notification email. I guess there are two questions.

1. How to pass the property in Ant script to RTC?
2. How to customize the build notification email?

Thanks,
Qunfeng

2 answers



permanent link
Nick Edgar (6.5k711) | answered May 21 '13, 10:38 a.m.
JAZZ DEVELOPER
edited May 21 '13, 10:42 a.m.
Hi Qunfeng.  For (1), there's no way currently to update a build's properties after the fact (after the build has been requested), but you can make various contributions to the build, either using the Build Toolkit Ant tasks or via Java client API (for advanced scenarios).  One option would be to publish a log file (using the logPublisher Ant task) with the build number in its file name and/or contents.  

However, for (2), there's unfortunately no way currently to override the format of the build notification emails.  There is an existing enhancement request for this here: 
See also other items referenced from:

Given these restrictions, probably the simplest approach for now is to use the buildResultPublisher Ant task to change the label of the RTC build (i.e. override the timestamp based one normally assigned by JBE).  The emails will then include this updated label.

e.g. if you have a buildNumber Ant property, you can use:
<buildResultPublisher 
  repositoryAddress=...
  userId=...
  password=...
  buildResultUUID="${buildResultUUID}"
  label="${buildLabel} - ${buildNumber}"/>

Where the buildLabel property is the original label, provided by JBE.



Comments
Nick Edgar commented May 21 '13, 10:41 a.m.
JAZZ DEVELOPER

 Please ignore  <="" div=""> in the snippet above -- it's an artifact of the forum software.


permanent link
David Hou (1111) | answered May 28 '15, 6:37 a.m.
edited May 28 '15, 6:39 a.m.
@nedgar

Hi Nick,
I had tried your solution for customize the email notification, but it seems doesn't work.

I had define the tasks in the top of the build.xml:
 <taskdef name="buildResultPublisher" classname="com.ibm.team.build.ant.task.BuildResultPublisherTask" />

Then in the trigger_build target I had below codes:

<echo message="Before publish: buildID is : ${buildId}"/>
<buildresultpublisher repositoryAddress="${repositoryAddress}" userId="${userId}"  passwordFile="${passwordFile}" buildResultUUID="${buildResultUUID}"  label="${buildId}"/>
<echo message="Afterpublish: buildID is : ${buildId}"/>

As you can see from the log , I had the buildID property but can't link the updated label in the  build result tab:
    [echo] Before publish: buildID is 20150528-0226
     [echo] After publish: buildID is 20150528-0226

Please can you help to take a look?

Thanks
David

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.