在詹金斯中对参数组进行分组和修饰 [英] Grouping and decorating groups of parameters in Jenkins
问题描述
我正在编写具有很多参数的Jenkins管道作业,我正在寻找一种视觉将它们组合在一起的方法,这样它们将更易于理解-而不是仅仅拥有它们扔在那里.我会满足于至少暗示这些参数彼此相关的事实.可能是标题,可能是方框.是否有任何插件可以帮助我装饰这样的输入?
I'm writing a Jenkins pipeline job with quite a few parameters and I'm looking for a way to visually group them together so they will be easier to understand -rather than have them all just thrown in there. I'll settle for anything that at least hints a the fact that these parameters are related to each other. Could be a header, could be boxes. Is there any plugin that will help me decorate my inputs this way?
推荐答案
因此,在网上搜索很多之后,我终于找到了一个可以解决问题的插件. 参数分隔符插件. Wiki页面没有说明如何使其在管道中工作,但是经过反复试验,这就是我使其工作的方式.我希望这对其他人有用.
So, after much searching the web I finally found a plugin that does the trick. The Parameter Separator Plugin. The wiki page doesn't say how to make it work in a pipeline, but after some trial and error this is how I got it to work. I hope this is useful to others.
String sectionHeaderStyle = '''
color: white;
background: green;
font-family: Roboto, sans-serif !important;
padding: 5px;
text-align: center;
'''
String separatorStyle = '''
border: 0;
border-bottom: 1px dashed #ccc;
background: #999;
'''
properties([
parameters([
[
$class: 'ParameterSeparatorDefinition',
name: 'FOO_HEADER',
sectionHeader: 'Foo Parameters',
separatorStyle: separatorStyle,
sectionHeaderStyle: sectionHeaderStyle
],
string(
name: 'FOO 1'
),
string(
name: 'FOO 2'
),
string(
name: 'FOO 3'
),
[
$class: 'ParameterSeparatorDefinition',
name: 'BAR_HEADER',
sectionHeader: 'Bar Parameters',
separatorStyle: separatorStyle,
sectionHeaderStyle: sectionHeaderStyle
],
string(
name: 'BAR 1'
),
string(
name: 'BAR 2'
),
string(
name: 'BAR 3'
)
])
])
这是结果:
我使用Jenkins 2.61,管道插件2.5和参数分隔符插件1.0对此进行了测试
I tested this with Jenkins 2.61, Pipeline Plugin 2.5 and the Parameter Separator Plugin 1.0
这篇关于在詹金斯中对参数组进行分组和修饰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!