Merge "Implements: Archive publisher allow-empty setting."
This commit is contained in:
commit
c39c5de446
@ -40,12 +40,13 @@ def archive(parser, xml_parent, data):
|
|||||||
:arg str excludes: path specifier for artifacts to exclude
|
:arg str excludes: path specifier for artifacts to exclude
|
||||||
:arg bool latest-only: only keep the artifacts from the latest
|
:arg bool latest-only: only keep the artifacts from the latest
|
||||||
successful build
|
successful build
|
||||||
|
:arg bool allow-empty: pass the build if no artifacts are
|
||||||
|
found (default false)
|
||||||
|
|
||||||
Example::
|
Example:
|
||||||
|
|
||||||
|
.. literalinclude:: /../../tests/publishers/fixtures/archive001.yaml
|
||||||
|
|
||||||
publishers:
|
|
||||||
- archive:
|
|
||||||
artifacts: '*.tar.gz'
|
|
||||||
"""
|
"""
|
||||||
logger = logging.getLogger("%s:archive" % __name__)
|
logger = logging.getLogger("%s:archive" % __name__)
|
||||||
archiver = XML.SubElement(xml_parent, 'hudson.tasks.ArtifactArchiver')
|
archiver = XML.SubElement(xml_parent, 'hudson.tasks.ArtifactArchiver')
|
||||||
@ -66,6 +67,11 @@ def archive(parser, xml_parent, data):
|
|||||||
else:
|
else:
|
||||||
latest.text = 'false'
|
latest.text = 'false'
|
||||||
|
|
||||||
|
if 'allow-empty' in data:
|
||||||
|
empty = XML.SubElement(archiver, 'allowEmptyArchive')
|
||||||
|
# Default behavior is to fail the build.
|
||||||
|
empty.text = str(data.get('allow-empty', False)).lower()
|
||||||
|
|
||||||
|
|
||||||
def blame_upstream(parser, xml_parent, data):
|
def blame_upstream(parser, xml_parent, data):
|
||||||
"""yaml: blame-upstream
|
"""yaml: blame-upstream
|
||||||
|
10
tests/publishers/fixtures/archive001.xml
Normal file
10
tests/publishers/fixtures/archive001.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" ?>
|
||||||
|
<project>
|
||||||
|
<publishers>
|
||||||
|
<hudson.tasks.ArtifactArchiver>
|
||||||
|
<artifacts>*.tar.gz</artifacts>
|
||||||
|
<latestOnly>false</latestOnly>
|
||||||
|
<allowEmptyArchive>true</allowEmptyArchive>
|
||||||
|
</hudson.tasks.ArtifactArchiver>
|
||||||
|
</publishers>
|
||||||
|
</project>
|
4
tests/publishers/fixtures/archive001.yaml
Normal file
4
tests/publishers/fixtures/archive001.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
publishers:
|
||||||
|
- archive:
|
||||||
|
artifacts: '*.tar.gz'
|
||||||
|
allow-empty: 'true'
|
Loading…
Reference in New Issue
Block a user