Customize build email based on compiler warnings

Michael Narinsky December 30, 2012

Hello,

I would like to modify the standard bamboo build email to include information about compiler warnings.

For example, instead of this:

#10 was successful

100 tests in total.

I want to say this:

#10 was successful but with warnings

100 tests in total.

5 compiler warnings in total.

We use Maven task to complie our code and I've enabled complier warnings output in the project's POM.

I've also read Bamboo documenation on how to customize email notification message and confirmed that by modifying ChainCompletedHtmlEmail.ftl, I can get my email customized.

Now I need to figure out how to pass information about compiler warnings from Maven and use it in the build email.

Any suggestions will be appreciated.

Thanks,

Michael

1 answer

0 votes
Marcin Gardias
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 15, 2013

Well, I think it's possible provided you have access to Bamboo source distro and you are not afraid of some coding...

The way I would do it is to create new Task Plugin using existing Bamboo Maven Task as a base. Code can be found in Bamboo source distribution.

The modifications would be:

- adding code to the output handler that would parse the Maven warning information

- add warning count (and whatever else you need) to results' custom data. Sth like that:

public TaskResult execute(@NotNull final TaskContext taskContext) throws TaskException {

///... maven stuff here
  taskContext.getBuildContext().getBuildResult().getCustomBuildData().put("warningCount", warningCount));
}

- custom data get's saved with JobResultsSummary and you should be able to access it in notification ftl

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events