It's all about the answers!

Ask a question

Is there any way I can customize RTC Build email notifications ?


R Z (1273253) | asked Dec 14 '22, 4:08 a.m.
edited Jan 05 '23, 11:07 a.m. by David Lafreniere (4.8k7)

Is there any way I can customize RTC Build email notifications ?


I want to include some notes and hyperlink to build notifications.
Currently, I don't see a way to customize the view on ver 6.0.6.
If there are any options, please let me know.

Thanks in advance.

2 answers



permanent link
Ralph Schoon (63.1k33646) | answered Jan 05 '23, 3:01 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jan 05 '23, 3:01 a.m.

 As far as I can see, there is no way to do this.


permanent link
David Lafreniere (4.8k7) | answered Jan 05 '23, 11:07 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
edited Jan 05 '23, 11:09 a.m.

There is no out-of-the-box way of adding custom text content to the regular build notification emails.


If this is really needed, you can write your own server side plugins or client(build side) contributions to achieve this.

Ex: You can write a plugin that can be registered with your server that will run an async task periodically to scan for completed builds and send the relevant emails out (yes there will be two emails per build, but perhaps better than nothing to get custom emails). This is how the out-of-the-box build email notifications are sent. If this class is visible in the EWM server SDK, see the implementation for com.ibm.team.build.internal.service.notification.BuildNotificationTask. This is essentially a class that extends com.ibm.team.repository.service.async.AbstractAutoScheduledTask, and queries for particular ChangeEvents which represent completed builds.
ex: 
ChangeEventQueryModel model = ChangeEventQueryModel.ROOT;
IItemQuery query = IItemQuery.FACTORY.newInstance(model);
// we want all build changes between a certain date a time, and only those that were originally IN_PROGRESS       

query.filter(model.modified()._gtOrEq(query.newDateTimeArg())._and(model.modified()._lt(query.newDateTimeArg()))._and(                model.eventCategory()._eq(BuildChangeEvent.BUILD_RESULT_CHANGED_EVENT_CATEGORY))._and(
                model.stringExtensions()._eqKeyValue(BuildResultChangeEvent.KEY_OLD_BUILD_STATE,
                        BuildState.IN_PROGRESS.name())));
        query.orderByAsc(model.eventTime());


You can then use Foundation APIs to send emails using an example like:
MailSender sender = getMailerService().getDefaultSender();
getMailerService().sendMail(sender, email, subject, content, null);
 
There are other jazz forum topics that give up to date pointers (to articles/wikis) on how to contribute server side extensions using the public SDK/APIs (I don't have these links handy at the moment, but it should be easy to find if this is the direction you want to persue).

You could also have your build scripts (ex: Ant tasks) send out the appropriate emails, or contribute post-build participants code to a build definition (build public API also supports hooking in custom code for pre/build/post-build callbacks) (however it's probably easier to go with the async serverside task to do this, since this is what is already implemented).


Comments
Ralph Schoon commented Jan 05 '23, 11:10 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.