From 55e857af0f5209d647dd8d70f7bfa6a3ddb4ebab Mon Sep 17 00:00:00 2001 From: Chris Burroughs Date: Fri, 21 Aug 2015 14:42:12 -0400 Subject: [PATCH] support for the phabricator plugin This plugin integrates Jenkins with Phabricator's code review and CI systems. NOTE: The plugin also provides a wrapper. The future of that is unclear time at this time so no jjb support is added. Change-Id: I36727445a00ab07799ab8d8263340d87c8a13be2 --- jenkins_jobs/modules/publishers.py | 42 +++++++++++++++++++ setup.cfg | 1 + tests/publishers/fixtures/phabricator001.xml | 10 +++++ tests/publishers/fixtures/phabricator001.yaml | 5 +++ tests/publishers/fixtures/phabricator002.xml | 6 +++ tests/publishers/fixtures/phabricator002.yaml | 2 + tests/publishers/fixtures/phabricator003.xml | 12 ++++++ tests/publishers/fixtures/phabricator003.yaml | 7 ++++ 8 files changed, 85 insertions(+) create mode 100644 tests/publishers/fixtures/phabricator001.xml create mode 100644 tests/publishers/fixtures/phabricator001.yaml create mode 100644 tests/publishers/fixtures/phabricator002.xml create mode 100644 tests/publishers/fixtures/phabricator002.yaml create mode 100644 tests/publishers/fixtures/phabricator003.xml create mode 100644 tests/publishers/fixtures/phabricator003.yaml diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index c0057f884..cf9324742 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -5191,6 +5191,48 @@ def hipchat(parser, xml_parent, data): data['complete-message']) +def phabricator(parser, xml_parent, data): + """yaml: phabricator + Integrate with `Phabricator `_ + + Requires the Jenkins :jenkins-wiki:`Phabricator Plugin + `. + + :arg bool comment-on-success: Post a *comment* when the build + succeeds. (optional) + :arg bool uberalls-enabled: Integrate with uberalls. (optional) + :arg str comment-file: Include contents of given file if + commenting is enabled. (optional) + :arg int comment-size: Maximum comment character length. (optional) + :arg bool comment-with-console-link-on-failure: Post a *comment* + when the build fails. (optional) + + Example: + + .. literalinclude:: + /../../tests/publishers/fixtures/phabricator001.yaml + :language: yaml + """ + + root = XML.SubElement(xml_parent, + 'com.uber.jenkins.phabricator.PhabricatorNotifier') + + if 'comment-on-success' in data: + XML.SubElement(root, 'commentOnSuccess').text = str( + data.get('comment-on-success')).lower() + if 'uberalls-enabled' in data: + XML.SubElement(root, 'uberallsEnabled').text = str( + data.get('uberalls-enabled')).lower() + if 'comment-file' in data: + XML.SubElement(root, 'commentFile').text = data.get('comment-file') + if 'comment-size' in data: + XML.SubElement(root, 'commentSize').text = str( + data.get('comment-size')) + if 'comment-with-console-link-on-failure' in data: + XML.SubElement(root, 'commentWithConsoleLinkOnFailure').text = str( + data.get('comment-with-console-link-on-failure')).lower() + + class Publishers(jenkins_jobs.modules.base.Base): sequence = 70 diff --git a/setup.cfg b/setup.cfg index 3acef4f49..3f2a26fe7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -190,6 +190,7 @@ jenkins_jobs.publishers = maven-deploy=jenkins_jobs.modules.publishers:maven_deploy naginator=jenkins_jobs.modules.publishers:naginator performance=jenkins_jobs.modules.publishers:performance + phabricator=jenkins_jobs.modules.publishers:phabricator pipeline=jenkins_jobs.modules.publishers:pipeline plot=jenkins_jobs.modules.publishers:plot pmd=jenkins_jobs.modules.publishers:pmd diff --git a/tests/publishers/fixtures/phabricator001.xml b/tests/publishers/fixtures/phabricator001.xml new file mode 100644 index 000000000..cd62a352a --- /dev/null +++ b/tests/publishers/fixtures/phabricator001.xml @@ -0,0 +1,10 @@ + + + + + false + false + false + + + diff --git a/tests/publishers/fixtures/phabricator001.yaml b/tests/publishers/fixtures/phabricator001.yaml new file mode 100644 index 000000000..965087e85 --- /dev/null +++ b/tests/publishers/fixtures/phabricator001.yaml @@ -0,0 +1,5 @@ +publishers: + - phabricator: + comment-on-success: false + uberalls-enabled: false + comment-with-console-link-on-failure: false diff --git a/tests/publishers/fixtures/phabricator002.xml b/tests/publishers/fixtures/phabricator002.xml new file mode 100644 index 000000000..f6950275b --- /dev/null +++ b/tests/publishers/fixtures/phabricator002.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/publishers/fixtures/phabricator002.yaml b/tests/publishers/fixtures/phabricator002.yaml new file mode 100644 index 000000000..19c20637a --- /dev/null +++ b/tests/publishers/fixtures/phabricator002.yaml @@ -0,0 +1,2 @@ +publishers: + - phabricator diff --git a/tests/publishers/fixtures/phabricator003.xml b/tests/publishers/fixtures/phabricator003.xml new file mode 100644 index 000000000..febbb4274 --- /dev/null +++ b/tests/publishers/fixtures/phabricator003.xml @@ -0,0 +1,12 @@ + + + + + false + false + .foo + 137 + false + + + diff --git a/tests/publishers/fixtures/phabricator003.yaml b/tests/publishers/fixtures/phabricator003.yaml new file mode 100644 index 000000000..fce9d3f89 --- /dev/null +++ b/tests/publishers/fixtures/phabricator003.yaml @@ -0,0 +1,7 @@ +publishers: + - phabricator: + comment-on-success: false + uberalls-enabled: false + comment-file: '.foo' + comment-size: 137 + comment-with-console-link-on-failure: false