将html选择值读入jenkins Active Choices Reactive Parameter

Posted

技术标签:

【中文标题】将html选择值读入jenkins Active Choices Reactive Parameter【英文标题】:Read html select value into jenkins Active Choices Reactive Parameter 【发布时间】:2021-11-29 11:11:23 【问题描述】:

我看到许多使用格式化 html 的 Active Choices Reactive Parameter 示例,但没有一个使用 HTML select 输入类型。

这是我的 html sn-p(为简洁起见,简化了 json_files 的输入):

def json_files = ["a", "b", "c"]

html_to_be_rendered = """<select id="config" name="config">"""

json_files.each  json_file ->
  html_to_be_rendered = """
    $html_to_be_rendered
    <option value="$json_file">$json_file</option>
"""


return "$html_to_be_rendered</select>"

我认为我应该能够使用 $config 读取所选值,但似乎不起作用。

这是我在 jenkins GUI 中定义它的方式:

我错过了什么?

【问题讨论】:

【参考方案1】:

您遇到的唯一问题是selectname 属性应硬编码为value。 不需要id 属性。

【讨论】:

现在有效:def json_files = ["a", "b", "c"] html_to_be_rendered = """"

以上是关于将html选择值读入jenkins Active Choices Reactive Parameter的主要内容,如果未能解决你的问题,请参考以下文章

42-Jenkins-Active Choices插件实现级联参数

将扩展选择参数值从一个作业传递到 Jenkins 管道中的另一个远程作业

cnetos jenkins active(exited)

Jenkins选择Spring Boot配置文件的任何方式?

Jenkins持续集成 之 Active Directory身份登陆验证

Jenkins + Active Directory身份验证 - 缓慢登录