Customize build email based on compiler warnings

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 vote

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,567 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you