Update Logfilesizechecker to use convert xml
- Rename full and minimal test files to be more descriptive Change-Id: Ia70f4c23341c4bd5aa137f9620cb945aa9cce5fc Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
parent
d6add35e72
commit
0dec022703
@ -37,6 +37,7 @@ from jenkins_jobs.modules.helpers import artifactory_env_vars_patterns
|
||||
from jenkins_jobs.modules.helpers import artifactory_optional_props
|
||||
from jenkins_jobs.modules.helpers import artifactory_repository
|
||||
from jenkins_jobs.modules.helpers import config_file_provider_builder
|
||||
from jenkins_jobs.modules.helpers import convert_mapping_to_xml
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -224,26 +225,25 @@ def logfilesize(parser, xml_parent, data):
|
||||
:arg int size: Abort the build if logfile size is bigger than this
|
||||
value (in MiB, default 128). Only applies if set-own is true.
|
||||
|
||||
Minimum config example:
|
||||
Full Example:
|
||||
|
||||
.. literalinclude:: /../../tests/wrappers/fixtures/logfilesize002.yaml
|
||||
.. literalinclude:: /../../tests/wrappers/fixtures/logfilesize-full.yaml
|
||||
|
||||
Full config example:
|
||||
|
||||
.. literalinclude:: /../../tests/wrappers/fixtures/logfilesize001.yaml
|
||||
Minimal Example:
|
||||
|
||||
.. literalinclude:: /../../tests/wrappers/fixtures/logfilesize-minimal.yaml
|
||||
"""
|
||||
lfswrapper = XML.SubElement(xml_parent,
|
||||
'hudson.plugins.logfilesizechecker.'
|
||||
'LogfilesizecheckerWrapper')
|
||||
lfswrapper.set("plugin", "logfilesizechecker")
|
||||
|
||||
XML.SubElement(lfswrapper, 'setOwn').text = str(
|
||||
data.get('set-own', 'false')).lower()
|
||||
XML.SubElement(lfswrapper, 'maxLogSize').text = str(
|
||||
data.get('size', '128')).lower()
|
||||
XML.SubElement(lfswrapper, 'failBuild').text = str(
|
||||
data.get('fail', 'false')).lower()
|
||||
mapping = [
|
||||
('set-own', 'setOwn', False),
|
||||
('size', 'maxLogSize', 128),
|
||||
('fail', 'failBuild', False),
|
||||
]
|
||||
convert_mapping_to_xml(lfswrapper, data, mapping, fail_required=True)
|
||||
|
||||
|
||||
def timeout(parser, xml_parent, data):
|
||||
|
@ -3,8 +3,8 @@
|
||||
<buildWrappers>
|
||||
<hudson.plugins.logfilesizechecker.LogfilesizecheckerWrapper plugin="logfilesizechecker">
|
||||
<setOwn>true</setOwn>
|
||||
<maxLogSize>2048</maxLogSize>
|
||||
<failBuild>false</failBuild>
|
||||
<maxLogSize>1024</maxLogSize>
|
||||
<failBuild>true</failBuild>
|
||||
</hudson.plugins.logfilesizechecker.LogfilesizecheckerWrapper>
|
||||
</buildWrappers>
|
||||
</project>
|
@ -1,4 +1,5 @@
|
||||
wrappers:
|
||||
- logfilesize:
|
||||
set-own: true
|
||||
size: 2048
|
||||
size: 1024
|
||||
fail: true
|
@ -3,8 +3,8 @@
|
||||
<buildWrappers>
|
||||
<hudson.plugins.logfilesizechecker.LogfilesizecheckerWrapper plugin="logfilesizechecker">
|
||||
<setOwn>true</setOwn>
|
||||
<maxLogSize>1024</maxLogSize>
|
||||
<failBuild>true</failBuild>
|
||||
<maxLogSize>2048</maxLogSize>
|
||||
<failBuild>false</failBuild>
|
||||
</hudson.plugins.logfilesizechecker.LogfilesizecheckerWrapper>
|
||||
</buildWrappers>
|
||||
</project>
|
||||
|
@ -1,5 +1,4 @@
|
||||
wrappers:
|
||||
- logfilesize:
|
||||
set-own: true
|
||||
size: 1024
|
||||
fail: true
|
||||
size: 2048
|
||||
|
Loading…
Reference in New Issue
Block a user