upt*_*ood 5 jenkins jenkins-plugins jenkins-pipeline extended-choice-parameter
我在声明性 Jenkins 管道中使用带有 JSON 参数类型的扩展选择参数。我发现它非常适合为参数提供自定义 UI,并且它会根据用户输入返回 json。
我有一个用例,其中向用户显示的选项取决于另一个参数的值。我可以通过主动选择参数来实现这样的功能,但随后我就陷入了单选按钮、复选框、html 输入等的困境。
我在这里找到了一个合适的选项,我可以使 json 内的属性依赖于另一个属性:
{
"title": "An object",
"type": "object",
"properties": {
"fieldOne": {
"title": "I should be changed to 'foo'",
"type": "string",
"enum": ["foo","bar"],
"default": "bar"
},
"depender1": {
"title": "I depend on fieldOne to be 'foo'",
"type": "string",
"enum": ["lorem","ipsum"],
"options": {
"dependencies": {
"fieldOne": "foo"
}
}
},
"depender2": {
"title": "I depend on fieldOne to be 'bar'",
"type": "string",
"enum": ["dolor", "sit"],
"options": {
"dependencies": {
"fieldOne": "bar"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我在这里尝试时效果很好
但是当我在詹金斯上尝试同样的方法时,它不起作用。它显示所有 3 个文本框。我也看到了观察其他参数的选项,但我找不到如何将它用作我的参数的 if else 。
这是一个简单的示例,我想要实现的目标需要 dropdown-1 + Array(dropdown-2 + text field+text-field) 的 UI,其中数组的文本字段取决于 dropdown-1 的值,我无法创建主动选择中的相同 UI。
有谁知道 options.dependency 如何在 jenkins 中工作或者使用 watch/其他插件可以实现相同的效果?
归档时间: |
|
查看次数: |
3706 次 |
最近记录: |