Giter Club home page Giter Club logo

rundeck-slack-notification's Introduction

Rundeck SlackNotification Plugin

Use this notification plugin to post messages to Slack via incoming webhook using the Slack attachments format.

Installation

Copy SlackNotification.groovy to the Rundeck plugins directory $RDECK_BASE/libext/.

Configuration

Framework/Project Properties

This following properties can be set at the framework or project level:

  • webhookUrl - (required) the incoming webhook URL configured in Slack custom integrations.
  • iconEmoji - override default bot emoji
  • username - override default bot username

Additional Properties

The following properties are optional, and can be set at the framework/project level, as well as the instance-level for each job:

  • channel - channel(s) to post messages to. If not specified, will send to default channel configured for the incoming webhook on slack.com. Accepts a comma-delimited list of multiple channels and/or users (e.g. #general or #room1,#room2,@user1).
  • title - default title for message. Accepts ${job.*} and ${option.*} context variables, in addition to the following custom tokens that will be substituted at runtime:
    • ${job.STATUS} - job status (all caps)
    • ${job.Status} - job status (capitalized)
    • ${job.fullName} - job's full name in group/job format

The default title format is ${job.Status} [${job.project}] ${job.fullName} run by ${job.username} (#${job.execid}).

Configuration Examples

Configure the webhook URL with framework scope by adding an entry in $RDECK_BASE/etc/framework.properties:

framework.plugin.Notification.SlackNotification.webhookUrl=https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX

Configure the webhook URL with project scope by adding an entry to $RDECK_BASE/projects/[ProjectName]/etc/project.properties:

project.plugin.Notification.SlackNotification.webhookUrl=https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
# and maybe set a project-specific channel
project.plugin.Notification.SlackNotification.channel=\#myproject

rundeck-slack-notification's People

Contributors

bdclark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rundeck-slack-notification's Issues

Empty values cause errors and notifications are not sent

Hi,

After updating to rundeck to v3.0.8 I've noticed we are not receiving slack notifications any more.

I found this error in the logs:

2018-10-30 12:02:37.088 ERROR --- [pool-1-thread-1] rundeck.services.NotificationService     : Error sending notificat
ion: Notification{eventTrigger='onfailure', type='SlackNotification', content='{"additionalText":"","channel":"","title":"${job.Status} [${job.project}] ${job.fullName} run by ${job.username} (#${job.execid})","color":"","optionFields":
"","_includeFailedNodes":""}'}: class java.lang.NullPointerException: Cannot invoke method replaceAll() on null object

I added a quick condition to check for null, and then came up with this error:

2018-10-30 16:35:12.448 ERROR --- [eduler_Worker-1] rundeck.services.NotificationService     : Error sending notificat
ion: Notification{eventTrigger='onsuccess', type='SlackNotification', content='{"channel":"","optionFields":"","additionalText":"","color":"","title":"${job.Status} [${job.project}] ${job.fullName} run by ${job.username} (#${job.execid}
)","_includeFailedNodes":""}'}: class java.lang.NullPointerException: Cannot invoke method tokenize() on null object

Added another condition and I have slack notifications again.

I have no idea of groovy or how the plugin works, I just applied basic logic, so my workaround can be completely wrong.

Let me know what you think!

Thanks!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.