Update clone-workspace plugin

- update clone-workspace plugin to use convert_mapping_to_xml
- update doc string

Change-Id: Id4cefb9504f02ef1b654e223b6d9ddefaa122967
This commit is contained in:
Dong Ma 2016-09-08 02:13:22 +08:00
parent 6853cf5ae7
commit 23cbeda2e9
3 changed files with 13 additions and 16 deletions

View File

@ -624,12 +624,12 @@ def clone_workspace(registry, xml_parent, data):
Requires the Jenkins :jenkins-wiki:`Clone Workspace SCM Plugin
<Clone+Workspace+SCM+Plugin>`.
:arg str workspace-glob: Files to include in cloned workspace
:arg str workspace-glob: Files to include in cloned workspace (default '')
:arg str workspace-exclude-glob: Files to exclude from cloned workspace
:arg str criteria: Criteria for build to be archived. Can be 'any',
'not failed', or 'successful'. (default any )
'not failed', or 'successful'. (default 'any')
:arg str archive-method: Choose the method to use for archiving the
workspace. Can be 'tar' or 'zip'. (default tar)
workspace. Can be 'tar' or 'zip'. (default 'tar')
:arg bool override-default-excludes: Override default ant excludes.
(default false)
@ -648,12 +648,15 @@ def clone_workspace(registry, xml_parent, data):
cloneworkspace = XML.SubElement(
xml_parent,
'hudson.plugins.cloneworkspace.CloneWorkspacePublisher',
{'plugin': 'clone-workspace-scm'})
'hudson.plugins.cloneworkspace.CloneWorkspacePublisher')
cloneworkspace.set('plugin', 'clone-workspace-scm')
XML.SubElement(
cloneworkspace,
'workspaceGlob').text = data.get('workspace-glob', None)
mappings = [
('workspace-glob', 'workspaceGlob', ''),
('override-default-excludes', 'overrideDefaultExcludes', False),
]
helpers.convert_mapping_to_xml(
cloneworkspace, data, mappings, fail_required=True)
if 'workspace-exclude-glob' in data:
XML.SubElement(
@ -682,12 +685,6 @@ def clone_workspace(registry, xml_parent, data):
else:
XML.SubElement(cloneworkspace, 'archiveMethod').text = archive_method
override_default_excludes_str = str(
data.get('override-default-excludes', False)).lower()
override_default_excludes_elem = XML.SubElement(
cloneworkspace, 'overrideDefaultExcludes')
override_default_excludes_elem.text = override_default_excludes_str
def cloverphp(registry, xml_parent, data):
"""yaml: cloverphp

View File

@ -3,9 +3,9 @@
<publishers>
<hudson.plugins.cloneworkspace.CloneWorkspacePublisher plugin="clone-workspace-scm">
<workspaceGlob/>
<overrideDefaultExcludes>false</overrideDefaultExcludes>
<criteria>Any</criteria>
<archiveMethod>TAR</archiveMethod>
<overrideDefaultExcludes>false</overrideDefaultExcludes>
</hudson.plugins.cloneworkspace.CloneWorkspacePublisher>
</publishers>
</project>

View File

@ -3,10 +3,10 @@
<publishers>
<hudson.plugins.cloneworkspace.CloneWorkspacePublisher plugin="clone-workspace-scm">
<workspaceGlob>**/*.zip</workspaceGlob>
<overrideDefaultExcludes>false</overrideDefaultExcludes>
<workspaceExcludeGlob>**/*.tgz</workspaceExcludeGlob>
<criteria>Any</criteria>
<archiveMethod>TAR</archiveMethod>
<overrideDefaultExcludes>false</overrideDefaultExcludes>
</hudson.plugins.cloneworkspace.CloneWorkspacePublisher>
</publishers>
</project>