Merge "ansicolor: Enforce valid types"

This commit is contained in:
Zuul 2018-08-21 06:36:30 +00:00 committed by Gerrit Code Review
commit 9439f79226
5 changed files with 32 additions and 9 deletions

View File

@ -463,23 +463,25 @@ def ansicolor(registry, xml_parent, data):
Translate ANSI color codes to HTML in the console log.
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:
- ansicolor
.. literalinclude:: /../../tests/wrappers/fixtures/ansicolor-minimal.yaml
:language: yaml
# Explicitly setting the colormap
wrappers:
- ansicolor:
colormap: vga
Full Example:
.. literalinclude:: /../../tests/wrappers/fixtures/ansicolor-full.yaml
:language: yaml
"""
cwrapper = XML.SubElement(
xml_parent,
'hudson.plugins.ansicolor.AnsiColorBuildWrapper')
valid_types = ['xterm', 'vga', 'css', 'gnome-terminal']
mapping = [
('colormap', 'colorMapName', None),
('colormap', 'colorMapName', 'xterm', valid_types),
]
helpers.convert_mapping_to_xml(
cwrapper, data, mapping, fail_required=False)

View 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>

View File

@ -0,0 +1,3 @@
wrappers:
- ansicolor:
colormap: "gnome-terminal"

View 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>

View File

@ -0,0 +1,2 @@
wrappers:
- ansicolor