c3tp / jenkins-flowdock-notifier

A simple Groovy script which enables Flowdock notifications to be sent from a Jenkins Pipeline.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jenkins-flowdock-notifier

A simple Groovy script which enables Flowdock notifications to be sent from a Jenkins Pipeline. The current Flowdock notification plugin does not have any Pipeline integration--here is a stopgap.

Inspired by and lifted from this thread and this comment specifically.

NOTE: Flowdock inbox push api is depreciated

Prerequisites

The following must be available in your Jenkins installation to use this library:

  • Pipeline plugins, of course
  • Pipeline: Shared Groovy Libraries plugin
  • An appropriate source code management plugin supported by the above, probably the GitHub Branch Source plugin
  • Application created and integrated with the flow on flowdock you want to send notifications too. See below for more info.

Installation

A Jenkins administrator must install the library as follows:

  1. In Manage Jenkins => Configure System, find the Global Pipeline Libraries section.
  2. Click on Add.
  3. Specify:
  • Name: flowdock-notifier
  • Default version: master
  1. For retrieval method, assuming GitHub, select Modern SCM and then GitHub:
  • Owner: c3tp
  • Repository: jenkins-flowdock-notifier
  1. Click Save at the bottom.

Use

You must declare use of the library somewhere before use:

library 'flowdock-notifier'

Then, call flowdockNotify in an appropriate place in your pipeline. It needs to be a step-class block, including and probably most appropriately a post block. There are three arguments:

  1. this - passes the script object to the notifier function to provide necessary context
  2. type - tells the script if you want a flow message or inbox message. Only accepts string message or inbox
  3. A sources API Flow Token.
  4. A string containing list of tags (optional).

For example:

library 'flowdock-notifier'

pipeline {
    // ...
    post { 
        changed { 
            flowdockNotify this, 'type', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', '#test'
        }
    }
}

More info:

In order to get a flow_token to a source, you will need to create an application.

About

A simple Groovy script which enables Flowdock notifications to be sent from a Jenkins Pipeline.

License:GNU General Public License v3.0


Languages

Language:Groovy 100.0%