Merge "Add build-publisher to jenkins-job-builder"

This commit is contained in:
Jenkins 2013-11-14 11:25:53 +00:00 committed by Gerrit Code Review
commit 4aacd31888
4 changed files with 73 additions and 0 deletions

View File

@ -2810,6 +2810,52 @@ def git(parser, xml_parent, data):
handle_entity_children(note['note'], xml_note, note_mappings)
def build_publisher(parser, xml_parent, data):
"""yaml: build-publisher
This plugin allows records from one Jenkins to be published
on another Jenkins.
Requires the Jenkins `Build Publisher Plugin.
<https://wiki.jenkins-ci.org/display/JENKINS/Build+Publisher+Plugin>`_
:arg str servers: Specify the servers where to publish
Example::
publishers:
- build-publisher:
name: servername
publish-unstable-builds: true
publish-failed-builds: true
days-to-keep: -1
num-to-keep: -1
artifact-days-to-keep: -1
artifact-num-to-keep: -1
"""
reporter = XML.SubElement(
xml_parent,
'hudson.plugins.build__publisher.BuildPublisher')
XML.SubElement(reporter, 'serverName').text = data['name']
XML.SubElement(reporter, 'publishUnstableBuilds').text = \
str(data.get('publish-unstable-builds', True)).lower()
XML.SubElement(reporter, 'publishFailedBuilds').text = \
str(data.get('publish-failed-builds', True)).lower()
logrotator = XML.SubElement(reporter, 'logRotator')
XML.SubElement(logrotator, 'daysToKeep').text = \
str(data.get('days-to-keep', -1))
XML.SubElement(logrotator, 'numToKeep').text = \
str(data.get('num-to-keep', -1))
XML.SubElement(logrotator, 'artifactDaysToKeep').text = \
str(data.get('artifact-days-to-keep', -1))
XML.SubElement(logrotator, 'artifactNumToKeep').text = \
str(data.get('artifact-num-to-keep', -1))
class Publishers(jenkins_jobs.modules.base.Base):
sequence = 70

View File

@ -120,6 +120,7 @@ setuptools.setup(
'jenkins_jobs.publishers': [
'aggregate-tests=jenkins_jobs.modules.publishers:aggregate_tests',
'archive=jenkins_jobs.modules.publishers:archive',
'build-publisher=jenkins_jobs.modules.publishers:build_publisher',
'checkstyle=jenkins_jobs.modules.publishers:checkstyle',
'cifs=jenkins_jobs.modules.publishers:cifs',
'claim-build=jenkins_jobs.modules.publishers:claim_build',

View File

@ -0,0 +1,16 @@
<?xml version="1.0" ?>
<project>
<publishers>
<hudson.plugins.build__publisher.BuildPublisher>
<serverName>servername</serverName>
<publishUnstableBuilds>true</publishUnstableBuilds>
<publishFailedBuilds>false</publishFailedBuilds>
<logRotator>
<daysToKeep>-1</daysToKeep>
<numToKeep>100</numToKeep>
<artifactDaysToKeep>-1</artifactDaysToKeep>
<artifactNumToKeep>100</artifactNumToKeep>
</logRotator>
</hudson.plugins.build__publisher.BuildPublisher>
</publishers>
</project>

View File

@ -0,0 +1,10 @@
# vim: sw=4 ts=4 et
publishers:
- build-publisher:
name: servername
publish-unstable-builds: true
publish-failed-builds: false
days-to-keep: -1
num-to-keep: 100
artifact-days-to-keep: -1
artifact-num-to-keep: 100