Added support for Jenkins Campfire plugin

Basic setup of Campfire notifications from builds.

Change-Id: I4e0bc43a1583fe51e0510743844d66e82b184e23
This commit is contained in:
Peter Liljenberg 2014-01-27 11:29:40 +01:00
parent fedd76678b
commit 4400ed4f88
8 changed files with 100 additions and 0 deletions

View File

@ -91,6 +91,51 @@ def blame_upstream(parser, xml_parent, data):
'BlameUpstreamCommitersPublisher')
def campfire(parser, xml_parent, data):
"""yaml: campfire
Send build notifications to Campfire rooms.
Requires the Jenkins `Campfire Plugin.
<https://wiki.jenkins-ci.org/display/JENKINS/Campfire+Plugin
Campfire notifications global default values must be configured for
the Jenkins instance. Default values will be used if no specific
values are specified for each job, so all config params are optional.
:arg str subdomain: override the default campfire subdomain
:arg str token: override the default API token
:arg bool ssl: override the default 'use SSL'
:arg str room: override the default room name
Example:
.. literalinclude:: /../../tests/publishers/fixtures/campfire001.yaml
"""
root = XML.SubElement(xml_parent,
'hudson.plugins.campfire.'
'CampfireNotifier')
campfire = XML.SubElement(root, 'campfire')
if ('subdomain' in data and data['subdomain']):
subdomain = XML.SubElement(campfire, 'subdomain')
subdomain.text = data['subdomain']
if ('token' in data and data['token']):
token = XML.SubElement(campfire, 'token')
token.text = data['token']
if ('ssl' in data):
ssl = XML.SubElement(campfire, 'ssl')
ssl.text = str(data['ssl']).lower()
if ('room' in data and data['room']):
room = XML.SubElement(root, 'room')
name = XML.SubElement(room, 'name')
name.text = data['room']
XML.SubElement(room, 'campfire reference="../../campfire"')
def emotional_jenkins(parser, xml_parent, data):
"""yaml: emotional-jenkins
Emotional Jenkins.

View File

@ -124,6 +124,7 @@ setuptools.setup(
'blame-upstream=jenkins_jobs.modules.publishers:blame_upstream',
'build-publisher=jenkins_jobs.modules.publishers:build_publisher',
'checkstyle=jenkins_jobs.modules.publishers:checkstyle',
'campfire=jenkins_jobs.modules.publishers:campfire',
'cifs=jenkins_jobs.modules.publishers:cifs',
'claim-build=jenkins_jobs.modules.publishers:claim_build',
'cloverphp=jenkins_jobs.modules.publishers:cloverphp',

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.plugins.campfire.CampfireNotifier>
<campfire>
<subdomain>sub</subdomain>
<token>TOKEN</token>
<ssl>true</ssl>
</campfire>
<room>
<name>room</name>
<campfire reference="../../campfire"/>
</room>
</hudson.plugins.campfire.CampfireNotifier>
</publishers>
</project>

View File

@ -0,0 +1,6 @@
publishers:
- campfire:
subdomain: 'sub'
ssl: true
token: 'TOKEN'
room: 'room'

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.plugins.campfire.CampfireNotifier>
<campfire/>
</hudson.plugins.campfire.CampfireNotifier>
</publishers>
</project>

View File

@ -0,0 +1,2 @@
publishers:
- campfire

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.plugins.campfire.CampfireNotifier>
<campfire>
<subdomain>sub</subdomain>
<token>TOKEN</token>
<ssl>false</ssl>
</campfire>
<room>
<name>room</name>
<campfire reference="../../campfire"/>
</room>
</hudson.plugins.campfire.CampfireNotifier>
</publishers>
</project>

View File

@ -0,0 +1,6 @@
publishers:
- campfire:
subdomain: 'sub'
ssl: false
token: 'TOKEN'
room: 'room'