(hipchat) Accept list of hipchat rooms.

Change-Id: I8c840fdebd58ed4dd22c6a5cafa549bfaf5357cf
This commit is contained in:
Wayne 2015-02-07 15:49:44 -08:00 committed by Darragh Bailey
parent d2f9258864
commit 2c156b9606
3 changed files with 49 additions and 4 deletions

View File

@ -22,6 +22,10 @@ Enable HipChat notifications of build execution.
reported in HipChat room. For later plugin versions, explicit notify-*
setting is required (see below).
* **room** *(str)*: name of HipChat room to post messages to
.. deprecated:: 1.2.0 Please use 'rooms'.
* **rooms** *(list)*: list of HipChat rooms to post messages to
* **start-notify** *(bool)*: post messages about build start event
* **notify-success** *(bool)*: post messages about successful build event
(Jenkins HipChat plugin >= 0.1.5)
@ -101,9 +105,6 @@ class HipChat(jenkins_jobs.modules.base.Base):
hipchat = data.get('hipchat')
if not hipchat or not hipchat.get('enabled', True):
return
if('room' not in hipchat):
raise jenkins_jobs.errors.YAMLFormatError(
"Missing hipchat 'room' specifier")
self._load_global_data()
properties = xml_parent.find('properties')
@ -112,7 +113,17 @@ class HipChat(jenkins_jobs.modules.base.Base):
pdefhip = XML.SubElement(properties,
'jenkins.plugins.hipchat.'
'HipChatNotifier_-HipChatJobProperty')
XML.SubElement(pdefhip, 'room').text = hipchat['room']
room = XML.SubElement(pdefhip, 'room')
if 'rooms' in hipchat:
room.text = ",".join(hipchat['rooms'])
elif 'room' in hipchat:
logger.warn("'room' is deprecated, please use 'rooms'")
room.text = hipchat['room']
else:
raise jenkins_jobs.errors.YAMLFormatError(
"Must specify either 'room' or 'rooms' in hipchat config.")
XML.SubElement(pdefhip, 'startNotification').text = str(
hipchat.get('start-notify', False)).lower()
if hipchat.get('notify-success'):

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<jenkins.plugins.hipchat.HipChatNotifier_-HipChatJobProperty>
<room>My Room,Your Room</room>
<startNotification>true</startNotification>
<notifySuccess>true</notifySuccess>
<notifyAborted>true</notifyAborted>
<notifyNotBuilt>true</notifyNotBuilt>
<notifyUnstable>true</notifyUnstable>
<notifyFailure>true</notifyFailure>
<notifyBackToNormal>true</notifyBackToNormal>
</jenkins.plugins.hipchat.HipChatNotifier_-HipChatJobProperty>
</properties>
<publishers>
<jenkins.plugins.hipchat.HipChatNotifier>
<jenkinsUrl>url</jenkinsUrl>
<authToken>authtoken</authToken>
<room/>
</jenkins.plugins.hipchat.HipChatNotifier>
</publishers>
</project>

View File

@ -0,0 +1,12 @@
hipchat:
enabled: true
rooms:
- My Room
- Your Room
start-notify: true
notify-success: true
notify-aborted: true
notify-not-built: true
notify-unstable: true
notify-failure: true
notify-back-to-normal: true