Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge remote-tracking branch 'eddyhub/JENKINS-32764'
- Loading branch information
Showing
5 changed files
with
243 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...n/docs/examples/javaposse/jobdsl/dsl/helpers/publisher/PublisherContext/mattermost.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
job('example') { | ||
publishers { | ||
mattermost { | ||
room('foobar team') | ||
notifySuccess() | ||
notifyAborted() | ||
notifyBackToNormal() | ||
showCommitList() | ||
} | ||
} | ||
} | ||
|
||
job('example2') { | ||
publishers { | ||
mattermost { | ||
endpoint('https://mattermost.my-company.de/hooks/um9hcztr1jfnzgph6397pcoeur') | ||
icon('http://jenkins.my-company.de/static/3d886fd0/images/foobar.png') | ||
room('foobar team') | ||
notifySuccess() | ||
notifyAborted() | ||
notifyBackToNormal() | ||
showCommitList() | ||
} | ||
} | ||
} |
118 changes: 118 additions & 0 deletions
118
.../src/main/groovy/javaposse/jobdsl/dsl/helpers/publisher/MattermostPublisherContext.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
package javaposse.jobdsl.dsl.helpers.publisher | ||
|
||
import javaposse.jobdsl.dsl.Context | ||
|
||
class MattermostPublisherContext implements Context { | ||
String endpoint | ||
String room | ||
String icon | ||
String customMessage | ||
boolean notifyBuildStart | ||
boolean notifySuccess | ||
boolean notifyAborted | ||
boolean notifyNotBuilt | ||
boolean notifyUnstable | ||
boolean notifyFailure | ||
boolean notifyBackToNormal | ||
boolean notifyRepeatedFailure | ||
boolean includeTestSummary | ||
boolean showCommitList | ||
|
||
/** | ||
* Sends a notification when the build starts. Defaults to {@code false}. | ||
*/ | ||
void notifyBuildStart(boolean notifyBuildStart = true) { | ||
this.notifyBuildStart = notifyBuildStart | ||
} | ||
|
||
/** | ||
* Sends a notification when the build is successful. Defaults to {@code false}. | ||
*/ | ||
void notifySuccess(boolean notifySuccess = true) { | ||
this.notifySuccess = notifySuccess | ||
} | ||
|
||
/** | ||
* Sends a notification when the build is aborted. Defaults to {@code false}. | ||
*/ | ||
void notifyAborted(boolean notifyAborted = true) { | ||
this.notifyAborted = notifyAborted | ||
} | ||
|
||
/** | ||
* Sends a notification when the build is not build. Defaults to {@code false}. | ||
*/ | ||
void notifyNotBuilt(boolean notifyNotBuilt = true) { | ||
this.notifyNotBuilt = notifyNotBuilt | ||
} | ||
|
||
/** | ||
* Sends a notification when the build is unstable. Defaults to {@code false}. | ||
*/ | ||
void notifyUnstable(boolean notifyUnstable = true) { | ||
this.notifyUnstable = notifyUnstable | ||
} | ||
|
||
/** | ||
* Sends a notification when the build is failed. Defaults to {@code false}. | ||
*/ | ||
void notifyFailure(boolean notifyFailure = true) { | ||
this.notifyFailure = notifyFailure | ||
} | ||
|
||
/** | ||
* Sends a notification when the build is back to normal. Defaults to {@code false}. | ||
*/ | ||
void notifyBackToNormal(boolean notifyBackToNormal = true) { | ||
this.notifyBackToNormal = notifyBackToNormal | ||
} | ||
|
||
/** | ||
* Sends a notification when the build repeats to fail. Defaults to {@code false}. | ||
*/ | ||
void notifyRepeatedFailure(boolean notifyRepeatedFailure = true) { | ||
this.notifyRepeatedFailure = notifyRepeatedFailure | ||
} | ||
|
||
/** | ||
* Include the test summary in the build message. Defaults to {@code false}. | ||
*/ | ||
void includeTestSummary(boolean includeTestSummary = true) { | ||
this.includeTestSummary = includeTestSummary | ||
} | ||
|
||
/** | ||
* Include the commit list with titles and authors in the build message. Defaults to {@code false}. | ||
*/ | ||
void showCommitList(boolean showCommitList = true) { | ||
this.showCommitList = showCommitList | ||
} | ||
|
||
/** | ||
* Configures your Mattermost incoming webhook URL. | ||
*/ | ||
void endpoint(String endpoint) { | ||
this.endpoint = endpoint | ||
} | ||
|
||
/** | ||
* Configures the channel names to which notifications should be sent. | ||
*/ | ||
void room(String room) { | ||
this.room = room | ||
} | ||
|
||
/** | ||
* Configures the URL to use as avatar for the message. | ||
*/ | ||
void icon(String icon) { | ||
this.icon = icon | ||
} | ||
|
||
/** | ||
* Configures custom message that will be included with the notifications displayed. | ||
*/ | ||
void customMessage(String customMessage) { | ||
this.customMessage = customMessage | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters