diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index 9c3325e6c..393e530f5 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -7586,6 +7586,25 @@ def chuck_norris(registry, xml_parent, data): return XML.SubElement(chuck, "factGenerator") +def publishers_from(registry, xml_parent, data): + """yaml: publishers-from + Use publishers from another project. + Requires the Jenkins :jenkins-wiki:`Template Project Plugin + `. + + :arg str project-name: The name of the other project. + + Example: + + .. literalinclude:: ../../tests/publishers/fixtures/publishers-from.yaml + :language: yaml + """ + pbs = XML.SubElement(xml_parent, + 'hudson.plugins.templateproject.ProxyPublisher') + mapping = [('project-name', 'projectName', None)] + helpers.convert_mapping_to_xml(pbs, data, mapping, fail_required=True) + + def tasks(registry, xml_parent, data): """yaml: tasks diff --git a/tests/publishers/fixtures/publishers-from.xml b/tests/publishers/fixtures/publishers-from.xml new file mode 100644 index 000000000..2369eb501 --- /dev/null +++ b/tests/publishers/fixtures/publishers-from.xml @@ -0,0 +1,8 @@ + + + + + base-build + + + diff --git a/tests/publishers/fixtures/publishers-from.yaml b/tests/publishers/fixtures/publishers-from.yaml new file mode 100644 index 000000000..322ba4772 --- /dev/null +++ b/tests/publishers/fixtures/publishers-from.yaml @@ -0,0 +1,3 @@ +publishers: + - publishers-from: + project-name: base-build