Support site monitor publisher

This publisher allows to check an URL after the build steps. It requires
the sitemonitor plugin from

https://wiki.jenkins-ci.org/display/JENKINS/SiteMonitor+Plugin

Change-Id: I83026e4db9bd7975a34b7d8e015a4a73c3b09ae8
This commit is contained in:
Guido Günther 2014-01-24 13:56:35 +01:00
parent bbfdeff09a
commit 97cdaa8114
4 changed files with 45 additions and 0 deletions

View File

@ -3113,6 +3113,30 @@ def description_setter(parser, xml_parent, data):
XML.SubElement(descriptionsetter, 'setForMatrix').text = for_matrix
def sitemonitor(parser, xml_parent, data):
"""yaml: sitemonitor
This plugin checks the availability of an url.
It requires the `sitemonitor plugin.
<https://wiki.jenkins-ci.org/display/JENKINS/SiteMonitor+Plugin>`_
:arg list sites: List of URLs to check
Example:
.. literalinclude:: /../../tests/publishers/fixtures/sitemonitor001.yaml
"""
mon = XML.SubElement(xml_parent,
'hudson.plugins.sitemonitor.SiteMonitorRecorder')
if data.get('sites'):
sites = XML.SubElement(mon, 'mSites')
for siteurl in data.get('sites'):
site = XML.SubElement(sites,
'hudson.plugins.sitemonitor.model.Site')
XML.SubElement(site, 'mUrl').text = siteurl['url']
class Publishers(jenkins_jobs.modules.base.Base):
sequence = 70

View File

@ -152,6 +152,7 @@ setuptools.setup(
'junit=jenkins_jobs.modules.publishers:junit',
'logparser=jenkins_jobs.modules.publishers:logparser',
'maven-deploy=jenkins_jobs.modules.publishers:maven_deploy',
'sitemonitor=jenkins_jobs.modules.publishers:sitemonitor',
'performance=jenkins_jobs.modules.publishers:performance',
'pipeline=jenkins_jobs.modules.publishers:pipeline',
'plot=jenkins_jobs.modules.publishers:plot',

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.plugins.sitemonitor.SiteMonitorRecorder>
<mSites>
<hudson.plugins.sitemonitor.model.Site>
<mUrl>http://foo.example.com</mUrl>
</hudson.plugins.sitemonitor.model.Site>
<hudson.plugins.sitemonitor.model.Site>
<mUrl>http://bar.example.com:8080/</mUrl>
</hudson.plugins.sitemonitor.model.Site>
</mSites>
</hudson.plugins.sitemonitor.SiteMonitorRecorder>
</publishers>
</project>

View File

@ -0,0 +1,5 @@
publishers:
- sitemonitor:
sites:
- url: http://foo.example.com
- url: http://bar.example.com:8080/