From 3cedc7fb636f8ed3d9d95cdf51d67d393599606e Mon Sep 17 00:00:00 2001 From: tanhengyeow Date: Sat, 4 Aug 2018 13:17:15 +0800 Subject: [PATCH] Add support for "Nexus Repository Manager Publisher" Change-Id: Icf72b436048bc0364690da2f956ed8b564fa5aa5 Signed-off-by: Tan Heng Yeow --- jenkins_jobs/modules/builders.py | 27 +++++++++++++++++++ .../fixtures/nexus-repo-manager-minimal.xml | 9 +++++++ .../fixtures/nexus-repo-manager-minimal.yaml | 4 +++ 3 files changed, 40 insertions(+) create mode 100644 tests/builders/fixtures/nexus-repo-manager-minimal.xml create mode 100644 tests/builders/fixtures/nexus-repo-manager-minimal.yaml diff --git a/jenkins_jobs/modules/builders.py b/jenkins_jobs/modules/builders.py index 77ca9e4fd..f0314a01b 100644 --- a/jenkins_jobs/modules/builders.py +++ b/jenkins_jobs/modules/builders.py @@ -4172,6 +4172,33 @@ def nexus_iq_policy_evaluator(registry, xml_parent, data): XML.SubElement(scan_pattern_tag, 'scanPattern').text = scan_pattern +def nexus_repo_manager(registry, xml_parent, data): + """yaml: nexus-repo-manager + Allows for artifacts selected in Jenkins packages to be + available in Nexus Repository Manager. + Requires the Jenkins :jenkins-wiki:`Nexus + Platform Plugin `. + + :arg str instance-id: The ID of the Nexus Instance (required) + :arg str repo-id: The ID of the Nexus Repository (required) + + Minimal Example: + + .. literalinclude:: + /../../tests/builders/fixtures/nexus-repo-manager-minimal.yaml + :language: yaml + """ + nexus_repo_manager = XML.SubElement(xml_parent, + 'org.sonatype.nexus.ci.' + 'nxrm.NexusPublisherBuildStep') + mapping = [ + ('instance-id', 'nexusInstanceId', None), + ('repo-id', 'nexusRepositoryId', None), + ] + helpers.convert_mapping_to_xml(nexus_repo_manager, + data, mapping, fail_required=True) + + def ansible_playbook(parser, xml_parent, data): """yaml: ansible-playbook This plugin allows you to execute Ansible tasks as a job build step. diff --git a/tests/builders/fixtures/nexus-repo-manager-minimal.xml b/tests/builders/fixtures/nexus-repo-manager-minimal.xml new file mode 100644 index 000000000..f726707f3 --- /dev/null +++ b/tests/builders/fixtures/nexus-repo-manager-minimal.xml @@ -0,0 +1,9 @@ + + + + + Nexus-Repo-Instance + Releases + + + diff --git a/tests/builders/fixtures/nexus-repo-manager-minimal.yaml b/tests/builders/fixtures/nexus-repo-manager-minimal.yaml new file mode 100644 index 000000000..4e2d40299 --- /dev/null +++ b/tests/builders/fixtures/nexus-repo-manager-minimal.yaml @@ -0,0 +1,4 @@ +builders: + - nexus-repo-manager: + instance-id: Nexus-Repo-Instance + repo-id: Releases