Remove nonexistent servername and cleanup build publisher

Trying out build-publisher I found server name was not required nor ever needed in the output.

I've removed the legacy code and added proper formatted documentation and renamed and fixed the fixture test.

Change-Id: I66a0e7ae0a694564177aa9cddbc95b2cbcd31891
This commit is contained in:
Max Rydahl Andersen 2015-02-15 23:30:10 +01:00
parent de2b287d6d
commit 5460ee97dd
6 changed files with 39 additions and 35 deletions

View File

@ -3294,42 +3294,37 @@ def build_publisher(parser, xml_parent, data):
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
:arg bool publish-unstable-builds: publish unstable builds (default: true)
:arg bool publish-failed-builds: publish failed builds (default: true)
:arg int days-to-keep: days to keep when publishing results (optional)
:arg int num-to-keep: number of jobs to keep in the published results
(optional)
Example:
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
.. literalinclude::
/../../tests/publishers/fixtures/build-publisher002.yaml
"""
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))
if 'days-to-keep' in data or 'num-to-keep' in data:
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))
# hardcoded to -1 to emulate what the build publisher
# plugin seem to do.
XML.SubElement(logrotator, 'artifactDaysToKeep').text = "-1"
XML.SubElement(logrotator, 'artifactNumToKeep').text = "-1"
def stash(parser, xml_parent, data):

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.plugins.build__publisher.BuildPublisher>
<publishUnstableBuilds>true</publishUnstableBuilds>
<publishFailedBuilds>true</publishFailedBuilds>
</hudson.plugins.build__publisher.BuildPublisher>
</publishers>
</project>

View File

@ -0,0 +1,4 @@
publishers:
- build-publisher:
publish-unstable-builds: true
publish-failed-builds: true

View File

@ -2,14 +2,13 @@
<project>
<publishers>
<hudson.plugins.build__publisher.BuildPublisher>
<serverName>servername</serverName>
<publishUnstableBuilds>true</publishUnstableBuilds>
<publishFailedBuilds>false</publishFailedBuilds>
<publishFailedBuilds>true</publishFailedBuilds>
<logRotator>
<daysToKeep>-1</daysToKeep>
<numToKeep>100</numToKeep>
<artifactDaysToKeep>-1</artifactDaysToKeep>
<artifactNumToKeep>100</artifactNumToKeep>
<artifactNumToKeep>-1</artifactNumToKeep>
</logRotator>
</hudson.plugins.build__publisher.BuildPublisher>
</publishers>

View File

@ -0,0 +1,6 @@
publishers:
- build-publisher:
publish-unstable-builds: true
publish-failed-builds: true
days-to-keep: -1
num-to-keep: 100

View File

@ -1,9 +0,0 @@
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