Added clone-workspace publisher
Change-Id: I39c71d69b100206e09164f0b765bda14d6f428c6
This commit is contained in:
parent
a32288a573
commit
dcfe7696d0
@ -254,6 +254,77 @@ def trigger(parser, xml_parent, data):
|
|||||||
tcolor.text = thresholds[threshold]['color']
|
tcolor.text = thresholds[threshold]['color']
|
||||||
|
|
||||||
|
|
||||||
|
def clone_workspace(parser, xml_parent, data):
|
||||||
|
"""yaml: clone-workspace
|
||||||
|
Archive the workspace from builds of one project and reuse them as the SCM
|
||||||
|
source for another project.
|
||||||
|
Requires the Jenkins `Clone Workspace SCM Plugin.
|
||||||
|
<https://wiki.jenkins-ci.org/display/JENKINS/Clone+Workspace+SCM+Plugin>`_
|
||||||
|
|
||||||
|
:arg str workspace-glob: Files to include in cloned workspace
|
||||||
|
: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 )
|
||||||
|
:arg str archive-method: Choose the method to use for archiving the
|
||||||
|
workspace. Can be 'tar' or 'zip'. (default: tar)
|
||||||
|
:arg bool override-default-excludes: Override default ant excludes.
|
||||||
|
(default: false)
|
||||||
|
|
||||||
|
Minimal example:
|
||||||
|
|
||||||
|
.. literalinclude::
|
||||||
|
/../../tests/publishers/fixtures/clone-workspace001.yaml
|
||||||
|
|
||||||
|
Full example:
|
||||||
|
|
||||||
|
.. literalinclude::
|
||||||
|
/../../tests/publishers/fixtures/clone-workspace002.yaml
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
cloneworkspace = XML.SubElement(
|
||||||
|
xml_parent,
|
||||||
|
'hudson.plugins.cloneworkspace.CloneWorkspacePublisher',
|
||||||
|
{'plugin': 'clone-workspace-scm'})
|
||||||
|
|
||||||
|
XML.SubElement(
|
||||||
|
cloneworkspace,
|
||||||
|
'workspaceGlob').text = data.get('workspace-glob', None)
|
||||||
|
|
||||||
|
if 'workspace-exclude-glob' in data:
|
||||||
|
XML.SubElement(
|
||||||
|
cloneworkspace,
|
||||||
|
'workspaceExcludeGlob').text = data['workspace-exclude-glob']
|
||||||
|
|
||||||
|
criteria_list = ['Any', 'Not Failed', 'Successful']
|
||||||
|
|
||||||
|
criteria = data.get('criteria', 'Any').title()
|
||||||
|
|
||||||
|
if 'criteria' in data and criteria not in criteria_list:
|
||||||
|
raise JenkinsJobsException(
|
||||||
|
'clone-workspace criteria must be one of: '
|
||||||
|
+ ', '.join(criteria_list))
|
||||||
|
else:
|
||||||
|
XML.SubElement(cloneworkspace, 'criteria').text = criteria
|
||||||
|
|
||||||
|
archive_list = ['TAR', 'ZIP']
|
||||||
|
|
||||||
|
archive_method = data.get('archive-method', 'TAR').upper()
|
||||||
|
|
||||||
|
if 'archive-method' in data and archive_method not in archive_list:
|
||||||
|
raise JenkinsJobsException(
|
||||||
|
'clone-workspace archive-method must be one of: '
|
||||||
|
+ ', '.join(archive_list))
|
||||||
|
else:
|
||||||
|
XML.SubElement(cloneworkspace, 'archiveMethod').text = archive_method
|
||||||
|
|
||||||
|
XML.SubElement(
|
||||||
|
cloneworkspace,
|
||||||
|
'overrideDefaultExcludes').text = str(data.get(
|
||||||
|
'override-default-excludes',
|
||||||
|
False)).lower()
|
||||||
|
|
||||||
|
|
||||||
def cloverphp(parser, xml_parent, data):
|
def cloverphp(parser, xml_parent, data):
|
||||||
"""yaml: cloverphp
|
"""yaml: cloverphp
|
||||||
Capture code coverage reports from PHPUnit
|
Capture code coverage reports from PHPUnit
|
||||||
|
1
setup.py
1
setup.py
@ -127,6 +127,7 @@ setuptools.setup(
|
|||||||
'checkstyle=jenkins_jobs.modules.publishers:checkstyle',
|
'checkstyle=jenkins_jobs.modules.publishers:checkstyle',
|
||||||
'cifs=jenkins_jobs.modules.publishers:cifs',
|
'cifs=jenkins_jobs.modules.publishers:cifs',
|
||||||
'claim-build=jenkins_jobs.modules.publishers:claim_build',
|
'claim-build=jenkins_jobs.modules.publishers:claim_build',
|
||||||
|
'clone-workspace=jenkins_jobs.modules.publishers:clone_workspace',
|
||||||
'cloverphp=jenkins_jobs.modules.publishers:cloverphp',
|
'cloverphp=jenkins_jobs.modules.publishers:cloverphp',
|
||||||
'cobertura=jenkins_jobs.modules.publishers:cobertura',
|
'cobertura=jenkins_jobs.modules.publishers:cobertura',
|
||||||
'copy-to-master=jenkins_jobs.modules.publishers:copy_to_master',
|
'copy-to-master=jenkins_jobs.modules.publishers:copy_to_master',
|
||||||
|
11
tests/publishers/fixtures/clone-workspace001.xml
Normal file
11
tests/publishers/fixtures/clone-workspace001.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<publishers>
|
||||||
|
<hudson.plugins.cloneworkspace.CloneWorkspacePublisher plugin="clone-workspace-scm">
|
||||||
|
<workspaceGlob/>
|
||||||
|
<criteria>Any</criteria>
|
||||||
|
<archiveMethod>TAR</archiveMethod>
|
||||||
|
<overrideDefaultExcludes>false</overrideDefaultExcludes>
|
||||||
|
</hudson.plugins.cloneworkspace.CloneWorkspacePublisher>
|
||||||
|
</publishers>
|
||||||
|
</project>
|
2
tests/publishers/fixtures/clone-workspace001.yaml
Normal file
2
tests/publishers/fixtures/clone-workspace001.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
publishers:
|
||||||
|
- clone-workspace
|
12
tests/publishers/fixtures/clone-workspace002.xml
Normal file
12
tests/publishers/fixtures/clone-workspace002.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<publishers>
|
||||||
|
<hudson.plugins.cloneworkspace.CloneWorkspacePublisher plugin="clone-workspace-scm">
|
||||||
|
<workspaceGlob>**/*.zip</workspaceGlob>
|
||||||
|
<workspaceExcludeGlob>**/*.tgz</workspaceExcludeGlob>
|
||||||
|
<criteria>Any</criteria>
|
||||||
|
<archiveMethod>TAR</archiveMethod>
|
||||||
|
<overrideDefaultExcludes>false</overrideDefaultExcludes>
|
||||||
|
</hudson.plugins.cloneworkspace.CloneWorkspacePublisher>
|
||||||
|
</publishers>
|
||||||
|
</project>
|
7
tests/publishers/fixtures/clone-workspace002.yaml
Normal file
7
tests/publishers/fixtures/clone-workspace002.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
publishers:
|
||||||
|
- clone-workspace:
|
||||||
|
criteria: "any"
|
||||||
|
archive-method: "tar"
|
||||||
|
override-default-excludes: false
|
||||||
|
workspace-glob: "**/*.zip"
|
||||||
|
workspace-exclude-glob: "**/*.tgz"
|
Loading…
x
Reference in New Issue
Block a user