Update workspace-cleanup plugin
- update workspace-cleanup plugin to convert xml - remove trailing \ - update test cases Change-Id: I7e5a126d7610811ac8c1120d01292f1c28f82f82
This commit is contained in:
parent
8a1c91327e
commit
5a9f6b1787
@ -2926,10 +2926,16 @@ def workspace_cleanup(registry, xml_parent, data):
|
||||
:arg str external-deletion-command: external deletion command to run
|
||||
against files and directories
|
||||
|
||||
Example:
|
||||
Minimal Example:
|
||||
|
||||
.. literalinclude::
|
||||
/../../tests/publishers/fixtures/workspace-cleanup001.yaml
|
||||
/../../tests/publishers/fixtures/workspace-cleanup-minimal.yaml
|
||||
:language: yaml
|
||||
|
||||
Full Example:
|
||||
|
||||
.. literalinclude::
|
||||
/../../tests/publishers/fixtures/workspace-cleanup-complete.yaml
|
||||
:language: yaml
|
||||
"""
|
||||
|
||||
@ -2949,12 +2955,12 @@ def workspace_cleanup(registry, xml_parent, data):
|
||||
XML.SubElement(ptrn, 'pattern').text = exc
|
||||
XML.SubElement(ptrn, 'type').text = "EXCLUDE"
|
||||
|
||||
XML.SubElement(p, 'deleteDirs').text = \
|
||||
str(data.get("dirmatch", False)).lower()
|
||||
XML.SubElement(p, 'cleanupMatrixParent').text = \
|
||||
str(data.get("clean-parent", False)).lower()
|
||||
XML.SubElement(p, 'externalDelete').text = \
|
||||
str(data.get('external-deletion-command', ''))
|
||||
mappings = [
|
||||
('dirmatch', 'deleteDirs', False),
|
||||
('clean-parent', 'cleanupMatrixParent', False),
|
||||
('external-deletion-command', 'externalDelete', '')
|
||||
]
|
||||
helpers.convert_mapping_to_xml(p, data, mappings, fail_required=True)
|
||||
|
||||
mask = [('success', 'cleanWhenSuccess'),
|
||||
('unstable', 'cleanWhenUnstable'),
|
||||
|
26
tests/publishers/fixtures/workspace-cleanup-complete.xml
Normal file
26
tests/publishers/fixtures/workspace-cleanup-complete.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
|
||||
<patterns>
|
||||
<hudson.plugins.ws__cleanup.Pattern>
|
||||
<pattern>*.zip</pattern>
|
||||
<type>INCLUDE</type>
|
||||
</hudson.plugins.ws__cleanup.Pattern>
|
||||
<hudson.plugins.ws__cleanup.Pattern>
|
||||
<pattern>*.txt</pattern>
|
||||
<type>EXCLUDE</type>
|
||||
</hudson.plugins.ws__cleanup.Pattern>
|
||||
</patterns>
|
||||
<deleteDirs>true</deleteDirs>
|
||||
<cleanupMatrixParent>true</cleanupMatrixParent>
|
||||
<externalDelete>command</externalDelete>
|
||||
<cleanWhenSuccess>false</cleanWhenSuccess>
|
||||
<cleanWhenUnstable>false</cleanWhenUnstable>
|
||||
<cleanWhenFailure>false</cleanWhenFailure>
|
||||
<cleanWhenNotBuilt>false</cleanWhenNotBuilt>
|
||||
<cleanWhenAborted>false</cleanWhenAborted>
|
||||
<notFailBuild>true</notFailBuild>
|
||||
</hudson.plugins.ws__cleanup.WsCleanup>
|
||||
</publishers>
|
||||
</project>
|
16
tests/publishers/fixtures/workspace-cleanup-complete.yaml
Normal file
16
tests/publishers/fixtures/workspace-cleanup-complete.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
publishers:
|
||||
- workspace-cleanup:
|
||||
include:
|
||||
- "*.zip"
|
||||
exclude:
|
||||
- "*.txt"
|
||||
clean-if:
|
||||
- success: false
|
||||
- unstable: false
|
||||
- failure: false
|
||||
- aborted: false
|
||||
- not-built: false
|
||||
dirmatch: true
|
||||
fail-build: false
|
||||
clean-parent: true
|
||||
external-deletion-command: 'command'
|
@ -2,19 +2,13 @@
|
||||
<project>
|
||||
<publishers>
|
||||
<hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
|
||||
<patterns>
|
||||
<hudson.plugins.ws__cleanup.Pattern>
|
||||
<pattern>*.zip</pattern>
|
||||
<type>INCLUDE</type>
|
||||
</hudson.plugins.ws__cleanup.Pattern>
|
||||
</patterns>
|
||||
<deleteDirs>false</deleteDirs>
|
||||
<cleanupMatrixParent>false</cleanupMatrixParent>
|
||||
<externalDelete/>
|
||||
<cleanWhenSuccess>true</cleanWhenSuccess>
|
||||
<cleanWhenUnstable>true</cleanWhenUnstable>
|
||||
<cleanWhenFailure>true</cleanWhenFailure>
|
||||
<cleanWhenNotBuilt>false</cleanWhenNotBuilt>
|
||||
<cleanWhenNotBuilt>true</cleanWhenNotBuilt>
|
||||
<cleanWhenAborted>true</cleanWhenAborted>
|
||||
<notFailBuild>true</notFailBuild>
|
||||
</hudson.plugins.ws__cleanup.WsCleanup>
|
2
tests/publishers/fixtures/workspace-cleanup-minimal.yaml
Normal file
2
tests/publishers/fixtures/workspace-cleanup-minimal.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
publishers:
|
||||
- workspace-cleanup
|
@ -1,7 +0,0 @@
|
||||
publishers:
|
||||
- workspace-cleanup:
|
||||
include:
|
||||
- "*.zip"
|
||||
clean-if:
|
||||
- success: true
|
||||
- not-built: false
|
Loading…
x
Reference in New Issue
Block a user