Merge "Add support for M2 repository cleanup plugin"
This commit is contained in:
commit
ceaf21d203
@ -287,6 +287,35 @@ def workspace_cleanup(parser, xml_parent, data):
|
||||
deldirs.text = str(data.get("dirmatch", False)).lower()
|
||||
|
||||
|
||||
def m2_repository_cleanup(parser, xml_parent, data):
|
||||
"""yaml: m2-repository-cleanup
|
||||
Configure M2 Repository Cleanup
|
||||
Requires the Jenkins `M2 Repository Cleanup.
|
||||
<https://wiki.jenkins-ci.org/display/JENKINS/M2+Repository+Cleanup+\
|
||||
Plugin>`_
|
||||
|
||||
:arg list patterns: List of patterns for artifacts to cleanup before
|
||||
building. (optional)
|
||||
|
||||
This plugin allows you to configure a maven2 job to clean some or all of
|
||||
the artifacts from the repository before it runs.
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude:: \
|
||||
../../tests/wrappers/fixtures/m2-repository-cleanup001.yaml
|
||||
"""
|
||||
m2repo = XML.SubElement(
|
||||
xml_parent,
|
||||
'hudson.plugins.m2__repo__reaper.M2RepoReaperWrapper')
|
||||
m2repo.set("plugin", "m2-repo-reaper")
|
||||
patterns = data.get("patterns", [])
|
||||
XML.SubElement(m2repo, 'artifactPatterns').text = ",".join(patterns)
|
||||
p = XML.SubElement(m2repo, 'patterns')
|
||||
for pattern in patterns:
|
||||
XML.SubElement(p, 'string').text = pattern
|
||||
|
||||
|
||||
def rvm_env(parser, xml_parent, data):
|
||||
"""yaml: rvm-env
|
||||
Set the RVM implementation
|
||||
|
@ -218,6 +218,7 @@ jenkins_jobs.wrappers =
|
||||
locks=jenkins_jobs.modules.wrappers:locks
|
||||
logfilesize=jenkins_jobs.modules.wrappers:logfilesize
|
||||
logstash=jenkins_jobs.modules.wrappers:logstash
|
||||
m2-repository-cleanup=jenkins_jobs.modules.wrappers:m2_repository_cleanup
|
||||
mask-passwords=jenkins_jobs.modules.wrappers:mask_passwords
|
||||
matrix-tie-parent=jenkins_jobs.modules.wrappers:matrix_tie_parent
|
||||
mongo-db=jenkins_jobs.modules.wrappers:mongo_db
|
||||
|
12
tests/wrappers/fixtures/m2-repository-cleanup001.xml
Normal file
12
tests/wrappers/fixtures/m2-repository-cleanup001.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<buildWrappers>
|
||||
<hudson.plugins.m2__repo__reaper.M2RepoReaperWrapper plugin="m2-repo-reaper">
|
||||
<artifactPatterns>com/ibm/**,com/microsoft/**</artifactPatterns>
|
||||
<patterns>
|
||||
<string>com/ibm/**</string>
|
||||
<string>com/microsoft/**</string>
|
||||
</patterns>
|
||||
</hudson.plugins.m2__repo__reaper.M2RepoReaperWrapper>
|
||||
</buildWrappers>
|
||||
</project>
|
5
tests/wrappers/fixtures/m2-repository-cleanup001.yaml
Normal file
5
tests/wrappers/fixtures/m2-repository-cleanup001.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
wrappers:
|
||||
- m2-repository-cleanup:
|
||||
patterns:
|
||||
- com/ibm/**
|
||||
- com/microsoft/**
|
9
tests/wrappers/fixtures/m2-repository-cleanup002.xml
Normal file
9
tests/wrappers/fixtures/m2-repository-cleanup002.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<buildWrappers>
|
||||
<hudson.plugins.m2__repo__reaper.M2RepoReaperWrapper plugin="m2-repo-reaper">
|
||||
<artifactPatterns/>
|
||||
<patterns/>
|
||||
</hudson.plugins.m2__repo__reaper.M2RepoReaperWrapper>
|
||||
</buildWrappers>
|
||||
</project>
|
2
tests/wrappers/fixtures/m2-repository-cleanup002.yaml
Normal file
2
tests/wrappers/fixtures/m2-repository-cleanup002.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
wrappers:
|
||||
- m2-repository-cleanup
|
Loading…
Reference in New Issue
Block a user