ansicolor: Enforce valid types
Change-Id: Ie14dcfc289bc0a88da8071cb4e308a49afd47a2a Signed-off-by: Tan Heng Yeow <E0032242@u.nus.edu>
This commit is contained in:
parent
b23394b47b
commit
4cce3d6a78
@ -463,23 +463,25 @@ def ansicolor(registry, xml_parent, data):
|
|||||||
Translate ANSI color codes to HTML in the console log.
|
Translate ANSI color codes to HTML in the console log.
|
||||||
Requires the Jenkins :jenkins-wiki:`Ansi Color Plugin <AnsiColor+Plugin>`.
|
Requires the Jenkins :jenkins-wiki:`Ansi Color Plugin <AnsiColor+Plugin>`.
|
||||||
|
|
||||||
:arg string colormap: (optional) color mapping to use
|
:arg string colormap: Color mapping to use (default xterm)
|
||||||
|
|
||||||
Examples::
|
Minimal Example:
|
||||||
|
|
||||||
wrappers:
|
.. literalinclude:: /../../tests/wrappers/fixtures/ansicolor-minimal.yaml
|
||||||
- ansicolor
|
:language: yaml
|
||||||
|
|
||||||
# Explicitly setting the colormap
|
Full Example:
|
||||||
wrappers:
|
|
||||||
- ansicolor:
|
.. literalinclude:: /../../tests/wrappers/fixtures/ansicolor-full.yaml
|
||||||
colormap: vga
|
:language: yaml
|
||||||
"""
|
"""
|
||||||
cwrapper = XML.SubElement(
|
cwrapper = XML.SubElement(
|
||||||
xml_parent,
|
xml_parent,
|
||||||
'hudson.plugins.ansicolor.AnsiColorBuildWrapper')
|
'hudson.plugins.ansicolor.AnsiColorBuildWrapper')
|
||||||
|
|
||||||
|
valid_types = ['xterm', 'vga', 'css', 'gnome-terminal']
|
||||||
mapping = [
|
mapping = [
|
||||||
('colormap', 'colorMapName', None),
|
('colormap', 'colorMapName', 'xterm', valid_types),
|
||||||
]
|
]
|
||||||
helpers.convert_mapping_to_xml(
|
helpers.convert_mapping_to_xml(
|
||||||
cwrapper, data, mapping, fail_required=False)
|
cwrapper, data, mapping, fail_required=False)
|
||||||
|
8
tests/wrappers/fixtures/ansicolor-full.xml
Normal file
8
tests/wrappers/fixtures/ansicolor-full.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<buildWrappers>
|
||||||
|
<hudson.plugins.ansicolor.AnsiColorBuildWrapper>
|
||||||
|
<colorMapName>gnome-terminal</colorMapName>
|
||||||
|
</hudson.plugins.ansicolor.AnsiColorBuildWrapper>
|
||||||
|
</buildWrappers>
|
||||||
|
</project>
|
3
tests/wrappers/fixtures/ansicolor-full.yaml
Normal file
3
tests/wrappers/fixtures/ansicolor-full.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
wrappers:
|
||||||
|
- ansicolor:
|
||||||
|
colormap: "gnome-terminal"
|
8
tests/wrappers/fixtures/ansicolor-minimal.xml
Normal file
8
tests/wrappers/fixtures/ansicolor-minimal.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<buildWrappers>
|
||||||
|
<hudson.plugins.ansicolor.AnsiColorBuildWrapper>
|
||||||
|
<colorMapName>xterm</colorMapName>
|
||||||
|
</hudson.plugins.ansicolor.AnsiColorBuildWrapper>
|
||||||
|
</buildWrappers>
|
||||||
|
</project>
|
2
tests/wrappers/fixtures/ansicolor-minimal.yaml
Normal file
2
tests/wrappers/fixtures/ansicolor-minimal.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
wrappers:
|
||||||
|
- ansicolor
|
Loading…
x
Reference in New Issue
Block a user