From 00f7a3f3b7998c2458b52f7031bc57fd54fcae2c Mon Sep 17 00:00:00 2001 From: Kien Ha Date: Thu, 28 Jul 2016 23:08:36 -0400 Subject: [PATCH] Add GitBucket plugin support Change-Id: I2a9fda9a91e382a65119a719655edd4ca340aa8c Signed-off-by: Kien Ha --- jenkins_jobs/modules/properties.py | 30 +++++++++++++++++++ tests/properties/fixtures/gitbucket-full.xml | 9 ++++++ tests/properties/fixtures/gitbucket-full.yaml | 4 +++ .../properties/fixtures/gitbucket-minimal.xml | 9 ++++++ .../fixtures/gitbucket-minimal.yaml | 3 ++ 5 files changed, 55 insertions(+) create mode 100644 tests/properties/fixtures/gitbucket-full.xml create mode 100644 tests/properties/fixtures/gitbucket-full.yaml create mode 100644 tests/properties/fixtures/gitbucket-minimal.xml create mode 100644 tests/properties/fixtures/gitbucket-minimal.yaml diff --git a/jenkins_jobs/modules/properties.py b/jenkins_jobs/modules/properties.py index b3bb04faf..e9ceaa998 100644 --- a/jenkins_jobs/modules/properties.py +++ b/jenkins_jobs/modules/properties.py @@ -121,6 +121,36 @@ def promoted_build(registry, xml_parent, data): XML.SubElement(active_processes, 'string').text = str(n) +def gitbucket(parser, xml_parent, data): + """yaml: gitbucket + Integrate GitBucket to Jenkins. + Requires the Jenkins :jenkins-wiki:`GitBucket Plugin `. + + :arg str url: GitBucket URL to issue (required) + :arg bool link-enabled: Enable hyperlink to issue (default false) + + Minimal Example: + + .. literalinclude:: /../../tests/properties/fixtures/gitbucket-minimal.yaml + :language: yaml + + Full Example: + + .. literalinclude:: /../../tests/properties/fixtures/gitbucket-full.yaml + :language: yaml + """ + gitbucket = XML.SubElement( + xml_parent, 'org.jenkinsci.plugins.gitbucket.GitBucketProjectProperty') + gitbucket.set('plugin', 'gitbucket') + + mapping = [ + ('url', 'url', None), + ('link-enabled', 'linkEnabled', False), + ] + helpers.convert_mapping_to_xml( + gitbucket, data, mapping, fail_required=True) + + def github(registry, xml_parent, data): """yaml: github Sets the GitHub URL for the project. diff --git a/tests/properties/fixtures/gitbucket-full.xml b/tests/properties/fixtures/gitbucket-full.xml new file mode 100644 index 000000000..92c426036 --- /dev/null +++ b/tests/properties/fixtures/gitbucket-full.xml @@ -0,0 +1,9 @@ + + + + + https://foo.com + true + + + diff --git a/tests/properties/fixtures/gitbucket-full.yaml b/tests/properties/fixtures/gitbucket-full.yaml new file mode 100644 index 000000000..d6511ec8a --- /dev/null +++ b/tests/properties/fixtures/gitbucket-full.yaml @@ -0,0 +1,4 @@ +properties: + - gitbucket: + url: https://foo.com + link-enabled: true diff --git a/tests/properties/fixtures/gitbucket-minimal.xml b/tests/properties/fixtures/gitbucket-minimal.xml new file mode 100644 index 000000000..00affa4b9 --- /dev/null +++ b/tests/properties/fixtures/gitbucket-minimal.xml @@ -0,0 +1,9 @@ + + + + + https://foo.com + false + + + diff --git a/tests/properties/fixtures/gitbucket-minimal.yaml b/tests/properties/fixtures/gitbucket-minimal.yaml new file mode 100644 index 000000000..52d7e9e81 --- /dev/null +++ b/tests/properties/fixtures/gitbucket-minimal.yaml @@ -0,0 +1,3 @@ +properties: + - gitbucket: + url: https://foo.com