Adding Flowdock as a supported publisher

This change adds support for publishing build status to Flowdock via the
Flowdock plugin (https://github.com/jenkinsci/flowdock-plugin). The
plugin gives the ability to publish directly to a flow via a (mandatory)
API token supplied by the user.

Change-Id: Ibceecfe19e05e40e13547257e45d9b826e197d4b
This commit is contained in:
John Patterson 2015-07-09 12:10:55 -04:00 committed by nextrevision
parent 3b61f72e81
commit 0088216518
8 changed files with 230 additions and 0 deletions

View File

@ -4764,6 +4764,84 @@ def google_cloud_storage(parser, xml_parent, data):
properties, upload_element, types)
def flowdock(parser, xml_parent, data):
"""yaml: flowdock
This plugin publishes job build results to a Flowdock flow.
Requires the Jenkins :jenkins-wiki:`Flowdock Plugin
<Flowdock+Plugin>`.
:arg str token: API token for the targeted flow.
(required)
:arg str tags: Comma-separated list of tags to incude in message
(default "")
:arg bool chat-notification: Send chat notification when build fails
(default true)
:arg bool notify-success: Send notification on build success
(default true)
:arg bool notify-failure: Send notification on build failure
(default true)
:arg bool notify-fixed: Send notification when build is fixed
(default true)
:arg bool notify-unstable: Send notification when build is unstable
(default false)
:arg bool notify-aborted: Send notification when build was aborted
(default false)
:arg bool notify-notbuilt: Send notification when build did not occur
(default false)
Example:
.. literalinclude:: /../../tests/publishers/fixtures/flowdock001.yaml
:language: yaml
Full example:
.. literalinclude:: /../../tests/publishers/fixtures/flowdock002.yaml
:language: yaml
"""
def gen_notification_entry(data_item, default, text):
e = XML.SubElement(nm, 'entry')
XML.SubElement(e, 'com.flowdock.jenkins.BuildResult').text = text
XML.SubElement(e, 'boolean').text = str(
data.get(data_item, default)).lower()
def gen_setting(item, default):
XML.SubElement(parent, 'notify%s' % item).text = str(
data.get('notify-%s' % item.lower(), default)).lower()
# Raise exception if token was not specified
if 'token' not in data:
raise MissingAttributeError('token')
parent = XML.SubElement(xml_parent,
'com.flowdock.jenkins.FlowdockNotifier')
XML.SubElement(parent, 'flowToken').text = data['token']
XML.SubElement(parent, 'notificationTags').text = data.get('tags', '')
XML.SubElement(parent, 'chatNotification').text = str(
data.get('chat-notification', True)).lower()
nm = XML.SubElement(parent, 'notifyMap')
# notification entries
gen_notification_entry('notify-success', True, 'SUCCESS')
gen_notification_entry('notify-failure', True, 'FAILURE')
gen_notification_entry('notify-fixed', True, 'FIXED')
gen_notification_entry('notify-unstable', False, 'UNSTABLE')
gen_notification_entry('notify-aborted', False, 'ABORTED')
gen_notification_entry('notify-notbuilt', False, 'NOT_BUILT')
# notification settings
gen_setting('Success', True)
gen_setting('Failure', True)
gen_setting('Fixed', True)
gen_setting('Unstable', False)
gen_setting('Aborted', False)
gen_setting('NotBuilt', False)
class Publishers(jenkins_jobs.modules.base.Base):
sequence = 70

View File

@ -160,6 +160,7 @@ jenkins_jobs.publishers =
findbugs=jenkins_jobs.modules.publishers:findbugs
fingerprint=jenkins_jobs.modules.publishers:fingerprint
fitnesse=jenkins_jobs.modules.publishers:fitnesse
flowdock=jenkins_jobs.modules.publishers:flowdock
ftp=jenkins_jobs.modules.publishers:ftp
gatling=jenkins_jobs.modules.publishers:gatling
git=jenkins_jobs.modules.publishers:git

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<com.flowdock.jenkins.FlowdockNotifier>
<flowToken>abcdefghijklmnopqrstuvwxyzabcdef</flowToken>
<notificationTags/>
<chatNotification>true</chatNotification>
<notifyMap>
<entry>
<com.flowdock.jenkins.BuildResult>SUCCESS</com.flowdock.jenkins.BuildResult>
<boolean>true</boolean>
</entry>
<entry>
<com.flowdock.jenkins.BuildResult>FAILURE</com.flowdock.jenkins.BuildResult>
<boolean>true</boolean>
</entry>
<entry>
<com.flowdock.jenkins.BuildResult>FIXED</com.flowdock.jenkins.BuildResult>
<boolean>true</boolean>
</entry>
<entry>
<com.flowdock.jenkins.BuildResult>UNSTABLE</com.flowdock.jenkins.BuildResult>
<boolean>false</boolean>
</entry>
<entry>
<com.flowdock.jenkins.BuildResult>ABORTED</com.flowdock.jenkins.BuildResult>
<boolean>false</boolean>
</entry>
<entry>
<com.flowdock.jenkins.BuildResult>NOT_BUILT</com.flowdock.jenkins.BuildResult>
<boolean>false</boolean>
</entry>
</notifyMap>
<notifySuccess>true</notifySuccess>
<notifyFailure>true</notifyFailure>
<notifyFixed>true</notifyFixed>
<notifyUnstable>false</notifyUnstable>
<notifyAborted>false</notifyAborted>
<notifyNotBuilt>false</notifyNotBuilt>
</com.flowdock.jenkins.FlowdockNotifier>
</publishers>
</project>

View File

@ -0,0 +1,3 @@
publishers:
- flowdock:
token: abcdefghijklmnopqrstuvwxyzabcdef

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<com.flowdock.jenkins.FlowdockNotifier>
<flowToken>abcdefghijklmnopqrstuvwxyzabcdef</flowToken>
<notificationTags>jenkins,ci</notificationTags>
<chatNotification>true</chatNotification>
<notifyMap>
<entry>
<com.flowdock.jenkins.BuildResult>SUCCESS</com.flowdock.jenkins.BuildResult>
<boolean>true</boolean>
</entry>
<entry>
<com.flowdock.jenkins.BuildResult>FAILURE</com.flowdock.jenkins.BuildResult>
<boolean>true</boolean>
</entry>
<entry>
<com.flowdock.jenkins.BuildResult>FIXED</com.flowdock.jenkins.BuildResult>
<boolean>true</boolean>
</entry>
<entry>
<com.flowdock.jenkins.BuildResult>UNSTABLE</com.flowdock.jenkins.BuildResult>
<boolean>false</boolean>
</entry>
<entry>
<com.flowdock.jenkins.BuildResult>ABORTED</com.flowdock.jenkins.BuildResult>
<boolean>false</boolean>
</entry>
<entry>
<com.flowdock.jenkins.BuildResult>NOT_BUILT</com.flowdock.jenkins.BuildResult>
<boolean>false</boolean>
</entry>
</notifyMap>
<notifySuccess>true</notifySuccess>
<notifyFailure>true</notifyFailure>
<notifyFixed>true</notifyFixed>
<notifyUnstable>false</notifyUnstable>
<notifyAborted>false</notifyAborted>
<notifyNotBuilt>false</notifyNotBuilt>
</com.flowdock.jenkins.FlowdockNotifier>
</publishers>
</project>

View File

@ -0,0 +1,11 @@
publishers:
- flowdock:
token: abcdefghijklmnopqrstuvwxyzabcdef
tags: jenkins,ci
chat-notification: true
notify-success: true
notify-failure: true
notify-fixed: true
notify-unstable: false
notify-aborted: false
notify-notbuilt: false

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<com.flowdock.jenkins.FlowdockNotifier>
<flowToken>abcdefghijklmnopqrstuvwxyzabcdef</flowToken>
<notificationTags>jenkins,ci</notificationTags>
<chatNotification>false</chatNotification>
<notifyMap>
<entry>
<com.flowdock.jenkins.BuildResult>SUCCESS</com.flowdock.jenkins.BuildResult>
<boolean>false</boolean>
</entry>
<entry>
<com.flowdock.jenkins.BuildResult>FAILURE</com.flowdock.jenkins.BuildResult>
<boolean>false</boolean>
</entry>
<entry>
<com.flowdock.jenkins.BuildResult>FIXED</com.flowdock.jenkins.BuildResult>
<boolean>false</boolean>
</entry>
<entry>
<com.flowdock.jenkins.BuildResult>UNSTABLE</com.flowdock.jenkins.BuildResult>
<boolean>true</boolean>
</entry>
<entry>
<com.flowdock.jenkins.BuildResult>ABORTED</com.flowdock.jenkins.BuildResult>
<boolean>true</boolean>
</entry>
<entry>
<com.flowdock.jenkins.BuildResult>NOT_BUILT</com.flowdock.jenkins.BuildResult>
<boolean>true</boolean>
</entry>
</notifyMap>
<notifySuccess>false</notifySuccess>
<notifyFailure>false</notifyFailure>
<notifyFixed>false</notifyFixed>
<notifyUnstable>true</notifyUnstable>
<notifyAborted>true</notifyAborted>
<notifyNotBuilt>true</notifyNotBuilt>
</com.flowdock.jenkins.FlowdockNotifier>
</publishers>
</project>

View File

@ -0,0 +1,11 @@
publishers:
- flowdock:
token: abcdefghijklmnopqrstuvwxyzabcdef
tags: jenkins,ci
chat-notification: false
notify-success: false
notify-failure: false
notify-fixed: false
notify-unstable: true
notify-aborted: true
notify-notbuilt: true