forked from bitplaces/rundeck-slack-plugin
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'sawa/rewrite_use_incoming_webhook' into…
… rewrite_use_incoming_webhook
- Loading branch information
Showing
4 changed files
with
25 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,47 @@ | ||
rundeck-slack-plugin | ||
rundeck-slack-incoming-webhook-plugin | ||
====================== | ||
|
||
Sends rundeck notification messages to a slack channel. This plugin | ||
is based on HipChat Plugin from Hayden Bakkum | ||
Sends rundeck notification messages to a slack channel. This plugin is based on [rundeck-slack-plugin](https://github.com/bitplaces/rundeck-slack-plugin)(based on run-hipchat-plugin). | ||
|
||
Installation Instructions | ||
------------------------- | ||
|
||
1. build the source | ||
2. Copy the plugin jar (rundeck-slack-plugin-\<version\>.jar) into your $RDECK_BASE/libext - no restart of rundeck required. | ||
See the [Included Plugins | Rundeck Documentation](http://rundeck.org/docs/plugins-user-guide/installing.html#included-plugins "Included Plugins") for more information on installing rundeck plugins. | ||
|
||
See the [rundeck documentation](http://rundeck.org/docs/manual/plugins.html#installing-plugins) for more | ||
information on installing rundeck plugins. | ||
## Download jarfile | ||
|
||
## Configuration | ||
This plugin uses Slack webhooks. Create a new webhook and copy the provided token. | ||
|
||
![configuration](config.png) | ||
|
||
The only required configuration settings are: | ||
|
||
- `API Auth Token`: webhook token | ||
- `Team Domain`: the `mycompany` part of `https://mycompany.slack.com` | ||
1. Download jarfile from [releases](https://github.com/higanworks/rundeck-slack-incoming-webhook-plugin/releases). | ||
2. copy jarfile to `$RDECK_BASE/libext` | ||
|
||
Additionally you can set: | ||
## Build | ||
|
||
- `Icon Url`: location to pull the avatar icon (otherwise an emoji of `:rundeck:` will be used) | ||
- `User Name`: the username the message should come from (default: `RunDeck`) | ||
1. build the source by gradle. | ||
2. copy jarfile to `$RDECK_BASE/libext` | ||
|
||
### External Templates | ||
The HipChat plugin this was based off used FreeMarker templates for building the JSON to post to Slack. The challenge is when you wanted to change the layout of a message. | ||
Since the FreeMarker template was compiled in that meant recompiling the plugin for every change to the template. | ||
Additionally it meant you could not customize the template based on job status. | ||
|
||
The setting `External Template` allows you to define a FreeMarker template that you want to use for the formatting of the Slack message. This is PER trigger so you can use a different template for start, failure and success and do so for each job. | ||
|
||
To use this, you'll need to create a directory in `/var/lib/rundeck/libext/templates` (This will be made customizable at some point). In that directory you can place FreeMarker templates for the JSON you want to post to Slack. The value for this setting is the name of the file (without the path). | ||
|
||
All the job context is passed in as a map named `externalData`. | ||
## Configuration | ||
This plugin uses Slack incoming-webhooks. Create a new webhook and copy the provided url. | ||
|
||
In the following screenshot, you can see and example of this: | ||
![configuration](config.png) | ||
|
||
![screenshot](example.png) | ||
The only required configuration settings are: | ||
|
||
The start message was posted using the baked in template (the default). | ||
The success message, however, was formatted using the following custom template: | ||
- `WebHook URL`: Slack incoming-webhook URL. | ||
|
||
``` | ||
{ | ||
"text": "<${executionData.href}|Execution #${executionData.id}> of job <${executionData.job.href}|${executionData.job.name}> has <#if trigger == "start">started<#elseif trigger == "failure">failed<#elseif trigger == "success">succeeded</#if>", | ||
"color": "${color}", | ||
"channel":"${channel}", | ||
<#if (username)?has_content> | ||
"username": "${username}", | ||
<#else> | ||
"username": "RunDeck", | ||
</#if> | ||
<#if (icon_url)?has_content> | ||
"icon_url": "${icon_url}" | ||
<#else> | ||
"icon_emoji": ":rundeck:" | ||
</#if> | ||
} | ||
``` | ||
## Slack message example. | ||
|
||
This can give you much more compact messages should you want that. | ||
On success. | ||
|
||
### Slack icon | ||
![on success](on_success.png) | ||
|
||
You have three possibilties to enable slack icons for incoming web-hooks: | ||
On failure. | ||
|
||
1. define a icon-url in RunDeck job configuration | ||
2. set a custom emoji in slack for `:rundeck:`, see [here](https://slack.com/emoji), leave the icon-url empty | ||
3. set default icon for Incoming WebHooks | ||
![on failure](on_failure.png) | ||
|
||
## Contributors | ||
* Original author: Hayden Bakkum @hbakkum | ||
* @totallyunknown | ||
* @notandy | ||
* @lusis | ||
* Original [hbakkum/rundeck-hipchat-plugin](https://github.com/hbakkum/rundeck-hipchat-plugin) author: Hayden Bakkum @hbakkum | ||
* Original [bitplaces/rundeck-slack-plugin](https://github.com/bitplaces/rundeck-slack-plugin) authors | ||
* @totallyunknown | ||
* @notandy | ||
* @lusis | ||
* @sawanoboly |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.