diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index e8893c1ce..6f777db35 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -2161,6 +2161,35 @@ def jira(parser, xml_parent, data): XML.SubElement(xml_parent, 'hudson.plugins.jira.JiraIssueUpdater') +def growl(parser, xml_parent, data): + """yaml: growl + Push notifications to growl client. + Requires the Jenkins :jenkins-wiki:`Growl Plugin `. + + :arg str ip: IP address to send growl notifications to (required) + :arg bool notify-only-on-fail-or-recovery: send a growl only when build + fails or recovers from a failure (default false) + + Minimal Example: + + .. literalinclude:: /../../tests/publishers/fixtures/growl-minimal.yaml + :language: yaml + + Full Example: + + .. literalinclude:: /../../tests/publishers/fixtures/growl-full.yaml + :language: yaml + """ + growl = XML.SubElement(xml_parent, 'hudson.plugins.growl.GrowlPublisher') + growl.set('plugin', 'growl') + + mapping = [ + ('ip', 'IP', None), + ('notify-only-on-fail-or-recovery', 'onlyOnFailureOrRecovery', False), + ] + helpers.convert_mapping_to_xml(growl, data, mapping, fail_required=True) + + def groovy_postbuild(parser, xml_parent, data): """yaml: groovy-postbuild Execute a groovy script. diff --git a/tests/publishers/fixtures/growl-full.xml b/tests/publishers/fixtures/growl-full.xml new file mode 100644 index 000000000..38eca0ed3 --- /dev/null +++ b/tests/publishers/fixtures/growl-full.xml @@ -0,0 +1,9 @@ + + + + + foo.ip.address + true + + + diff --git a/tests/publishers/fixtures/growl-full.yaml b/tests/publishers/fixtures/growl-full.yaml new file mode 100644 index 000000000..72d60d7ab --- /dev/null +++ b/tests/publishers/fixtures/growl-full.yaml @@ -0,0 +1,4 @@ +publishers: + - growl: + ip: foo.ip.address + notify-only-on-fail-or-recovery: true diff --git a/tests/publishers/fixtures/growl-minimal.xml b/tests/publishers/fixtures/growl-minimal.xml new file mode 100644 index 000000000..7010cbf4f --- /dev/null +++ b/tests/publishers/fixtures/growl-minimal.xml @@ -0,0 +1,9 @@ + + + + + foo.ip.address + false + + + diff --git a/tests/publishers/fixtures/growl-minimal.yaml b/tests/publishers/fixtures/growl-minimal.yaml new file mode 100644 index 000000000..2aafb81cb --- /dev/null +++ b/tests/publishers/fixtures/growl-minimal.yaml @@ -0,0 +1,3 @@ +publishers: + - growl: + ip: foo.ip.address