Slack: support custom messages per build result
Add support for custom messages per build result in the Slack notification plugin. Change-Id: Iafc8b67528914c6d14c78f72aa535a3cfa7f7033 Story: 2007912 Task: 40315
This commit is contained in:
parent
cf8b2721ed
commit
8ed66b00a2
@ -7629,8 +7629,18 @@ def slack(registry, xml_parent, data):
|
||||
includes commit list with authors and titles (>=2.0). (default "NONE")
|
||||
:arg bool include-custom-message: Include a custom message into the
|
||||
notification (>=2.0). (default false)
|
||||
:arg str custom-message: Custom message to be included (>=2.0).
|
||||
(default '')
|
||||
:arg str custom-message: Custom message to be included for all statuses
|
||||
(>=2.0). (default '')
|
||||
:arg str custom-message-success: Custom message for succesful builds
|
||||
(>=2.10). (default '')
|
||||
:arg str custom-message-aborted: Custom message for aborted builds
|
||||
(>=2.10). (default '')
|
||||
:arg str custom-message-not-built: Custom message for not-built
|
||||
(>=2.10). (default '')
|
||||
:arg str custom-message-unstable: Custom message for unstable builds
|
||||
(>=2.10). (default '')
|
||||
:arg str custom-message-failure: Custom message for failed builds
|
||||
(>=2.10). (default '')
|
||||
:arg str auth-token-credential-id: The ID for the integration token from
|
||||
the Credentials plugin to be used to send notifications to Slack.
|
||||
(>=2.1) (default '')
|
||||
@ -7651,10 +7661,10 @@ def slack(registry, xml_parent, data):
|
||||
/../../tests/publishers/fixtures/slack003.yaml
|
||||
:language: yaml
|
||||
|
||||
Full example (version >= 2.0):
|
||||
Full example (version >= 2.10):
|
||||
|
||||
.. literalinclude::
|
||||
/../../tests/publishers/fixtures/slack004.yaml
|
||||
/../../tests/publishers/fixtures/slack005.yaml
|
||||
:language: yaml
|
||||
|
||||
"""
|
||||
@ -7695,6 +7705,11 @@ def slack(registry, xml_parent, data):
|
||||
("commit-info-choice", "commitInfoChoice", "NONE"),
|
||||
("include-custom-message", "includeCustomMessage", False),
|
||||
("custom-message", "customMessage", ""),
|
||||
("custom-message-success", "customMessageSuccess", ""),
|
||||
("custom-message-aborted", "customMessageAborted", ""),
|
||||
("custom-message-not-built", "customMessageNotBuilt", ""),
|
||||
("custom-message-unstable", "customMessageUnstable", ""),
|
||||
("custom-message-failure", "customMessageFailure", ""),
|
||||
("auth-token-credential-id", "authTokenCredentialId", ""),
|
||||
("bot-user", "botUser", False),
|
||||
("base-url", "baseUrl", ""),
|
||||
|
@ -22,6 +22,11 @@
|
||||
<commitInfoChoice>NONE</commitInfoChoice>
|
||||
<includeCustomMessage>false</includeCustomMessage>
|
||||
<customMessage/>
|
||||
<customMessageSuccess/>
|
||||
<customMessageAborted/>
|
||||
<customMessageNotBuilt/>
|
||||
<customMessageUnstable/>
|
||||
<customMessageFailure/>
|
||||
<authTokenCredentialId/>
|
||||
<botUser>false</botUser>
|
||||
<baseUrl/>
|
||||
|
@ -22,6 +22,11 @@
|
||||
<commitInfoChoice>AUTHORS_AND_TITLES</commitInfoChoice>
|
||||
<includeCustomMessage>true</includeCustomMessage>
|
||||
<customMessage>A custom message.</customMessage>
|
||||
<customMessageSuccess/>
|
||||
<customMessageAborted/>
|
||||
<customMessageNotBuilt/>
|
||||
<customMessageUnstable/>
|
||||
<customMessageFailure/>
|
||||
<authTokenCredentialId>yourauthtoken</authTokenCredentialId>
|
||||
<botUser>true</botUser>
|
||||
<baseUrl>https://hooks.slack.com/services/</baseUrl>
|
||||
|
3
tests/publishers/fixtures/slack005.plugins_info.yaml
Normal file
3
tests/publishers/fixtures/slack005.plugins_info.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
- longName: 'Slack Notification Plugin'
|
||||
shortName: 'slack'
|
||||
version: "2.10"
|
35
tests/publishers/fixtures/slack005.xml
Normal file
35
tests/publishers/fixtures/slack005.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<jenkins.plugins.slack.SlackNotifier>
|
||||
<teamDomain>teamname</teamDomain>
|
||||
<authToken>yourauthtoken</authToken>
|
||||
<authTokenCredentialId>yourauthtokenid</authTokenCredentialId>
|
||||
<buildServerUrl>http://localhost:8081</buildServerUrl>
|
||||
<room>#builds</room>
|
||||
<startNotification>true</startNotification>
|
||||
<notifySuccess>true</notifySuccess>
|
||||
<notifyAborted>true</notifyAborted>
|
||||
<notifyNotBuilt>true</notifyNotBuilt>
|
||||
<notifyUnstable>true</notifyUnstable>
|
||||
<notifyFailure>true</notifyFailure>
|
||||
<notifyEveryFailure>true</notifyEveryFailure>
|
||||
<notifyBackToNormal>true</notifyBackToNormal>
|
||||
<notifyRegression>true</notifyRegression>
|
||||
<notifyRepeatedFailure>true</notifyRepeatedFailure>
|
||||
<includeTestSummary>true</includeTestSummary>
|
||||
<includeFailedTests>true</includeFailedTests>
|
||||
<commitInfoChoice>AUTHORS_AND_TITLES</commitInfoChoice>
|
||||
<includeCustomMessage>true</includeCustomMessage>
|
||||
<customMessage>A custom message.</customMessage>
|
||||
<customMessageSuccess>A custom message for sucessful builds.</customMessageSuccess>
|
||||
<customMessageAborted>A custom message for aborted builds.</customMessageAborted>
|
||||
<customMessageNotBuilt>A custom message for not-built.</customMessageNotBuilt>
|
||||
<customMessageUnstable>A custom message for unstable builds.</customMessageUnstable>
|
||||
<customMessageFailure>A custom message for failed builds.</customMessageFailure>
|
||||
<authTokenCredentialId>yourauthtoken</authTokenCredentialId>
|
||||
<botUser>true</botUser>
|
||||
<baseUrl>https://hooks.slack.com/services/</baseUrl>
|
||||
</jenkins.plugins.slack.SlackNotifier>
|
||||
</publishers>
|
||||
</project>
|
30
tests/publishers/fixtures/slack005.yaml
Normal file
30
tests/publishers/fixtures/slack005.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
publishers:
|
||||
- slack:
|
||||
team-domain: 'teamname'
|
||||
auth-token: 'yourauthtoken'
|
||||
auth-token-id: 'yourauthtokenid'
|
||||
build-server-url: 'http://localhost:8081'
|
||||
room: '#builds'
|
||||
notify-start: True
|
||||
notify-success: True
|
||||
notify-aborted: True
|
||||
notify-not-built: True
|
||||
notify-unstable: True
|
||||
notify-failure: True
|
||||
notify-every-failure: True
|
||||
notify-back-to-normal: True
|
||||
notify-repeated-failure: True
|
||||
notify-regression: True
|
||||
include-test-summary: True
|
||||
include-failed-tests: True
|
||||
commit-info-choice: 'AUTHORS_AND_TITLES'
|
||||
include-custom-message: True
|
||||
custom-message: 'A custom message.'
|
||||
custom-message-success: 'A custom message for sucessful builds.'
|
||||
custom-message-aborted: 'A custom message for aborted builds.'
|
||||
custom-message-not-built: 'A custom message for not-built.'
|
||||
custom-message-unstable: 'A custom message for unstable builds.'
|
||||
custom-message-failure: 'A custom message for failed builds.'
|
||||
auth-token-credential-id: yourauthtoken
|
||||
bot-user: True
|
||||
base-url: https://hooks.slack.com/services/
|
Loading…
Reference in New Issue
Block a user