Skip to content
This repository has been archived by the owner on Mar 3, 2018. It is now read-only.

Commit

Permalink
Adding build no and error to notification message
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Fâciu committed Dec 5, 2016
1 parent 6791a64 commit f21e1cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ To install the plugin, put zip archive to 'plugins' dir under TeamCity data dire
* custom actions for threads (create issue in bug tracker if broken build, open drop folder, open web app etc.)
* view test results in notification
* custom user image (instead or if no Gravatar)
* more options to customize behaviour

Big thanks to [tcSlackBuildNotifier](https://github.com/PeteGoo/tcSlackBuildNotifier) which was quite useful for finding out how TeamCity and a custom notifier work :)

Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class NotificationBuilder(val flowdockConfig: FlowdockSettingsRepo, val tcServer
notification.author = NotificationAuthor(user.name, this.getUserGravatar(user.email), user.email)

notification.title = "<a href=\"${this.getTeamCityUrl(project?.projectId)}\"> TeamCity - ${project?.name}</a>"
notification.body = this.getDefaultNotificationMessage(notificationDetails)
notification.body = this.getDefaultNotificationMessage(type, notificationDetails, build)
notification.external_thread_id= "TC-${project?.projectId}"
if (build != null) {
notification.external_thread_id += "- ${build.fullName}"
Expand Down Expand Up @@ -96,8 +96,19 @@ class NotificationBuilder(val flowdockConfig: FlowdockSettingsRepo, val tcServer
* Creating notification body (html allowed)
* Should let user create a custom message...
*/
private fun getDefaultNotificationMessage(details: NotificationDetails?): String {
return "${details?.text}"
private fun getDefaultNotificationMessage(type: NotificationType, details: NotificationDetails?, build: SRunningBuild?): String {
var message = "${details?.text}"

if (build != null) {
message += " - Build No: " + build.buildNumber

if (type == NotificationType.BuildFailed) {
message += "<br>"
message += build.compilationErrorMessages.first()
}
}

return message
}

/**
Expand Down

0 comments on commit f21e1cf

Please sign in to comment.