-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to customize the message that gets printed in the chat room #37
Conversation
Quite unfortunately my notification refactor stayed in my local repo for a long while, which means that most likely this PR no longer applies. |
I can update to the latest version, if you like my current approach in the pull request. |
Providing var replacement for notification messages is a good first step on the way. I assume that the "completeJobMessage" is meant to be used for all notifications but started (i.e. unstable/failure/backtonormal/etc) in which case this approach looks fine to me. |
Yes, completeJobMessage is for everything but start. This can easily be extended to all states should somebody really need it. We have been pretty happy with one field the past few weeks. I like the refactoring, much nicer structure now. :) I'll port my changes and let you know when I'm done Thanks for the comments! |
Hmm I'm thinking about how to integrate my changes with the new properties file I suggest the following:
What do you think? (sorry for the edits) |
In NotificationType the messages aren't too different from each other, the complete status message would fit onto most state except not_built (which doesn't have duration string). The way these new settings should work probably is that they should override the original message coming from getMessage() method. The problem with having more than one "template" setting is that suddenly you have two choices:
|
Originally I planned these two templates:
And this the complete jobs:
This means you can completely rearrange the string. I see two options:
I know, the second way is a bit less 'elegant', but it's dead simple. Instead of composing the message from multiple sources/combination it either uses the plugins template, or the template defined by the user. You want to link to the console? No problem, its your <a/> tag. You don't want to print the full job name, but a internal reference? No worries, just remove $JOB_NAME and configure it statically (for this job!). What do you think? |
Just an idea, to resolve the template we could do something like in
|
The second option it is then. I would suggest to hide the new settings in an advanced section on the job config page, so at least the UI won't be too cluttered by default. |
65c9490
to
d49403c
Compare
I've (force) updated the branch After I was finished implementing the second option and tried to configure it on our systems it became obvious that it is completely unpractical. I removed the fields again and now solved it with the original two fields 'completed' and 'started. The defaults and the value for What do you think? |
Please let me know if you have any input to the general coding style! And I did some changes to the |
@@ -57,9 +57,29 @@ | |||
<dependency> | |||
<groupId>junit</groupId> | |||
<artifactId>junit</artifactId> | |||
<version>4.12</version> | |||
<version>4.11</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I trigged this bug here, thats the reason for the downgrade:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved by upgrading powermock to 1.6.1
These changes are looking really great. I had a look through the changes, and only had a few follow-up changes: 3639a74 |
Simpel but powerful way to customize the notification messages. For example the default 'complete' message is:
$JOB_NAME #$BUILD_NUMBER $STATUS ($CHANGES_OR_CAUSE) (<a href="$BUILD_URL">Open</a>)
All normal Jenkins and environment variables are available and allow countless combinations of configurations.
closes #25