【问题标题】:Read html select value into jenkins Active Choices Reactive Parameter将html选择值读入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 中定义它的方式:

我错过了什么?

【问题讨论】:

    标签: html jenkins jenkins-pipeline html-select


    【解决方案1】:

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

    【讨论】:

    • 现在有效:def json_files = ["a", "b", "c"] html_to_be_rendered = """"
    猜你喜欢
    • 1970-01-01
    • 2020-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-18
    • 1970-01-01
    • 1970-01-01
    • 2016-01-11
    相关资源
    最近更新 更多