[英]How to parse HTML content to Jenkins parameters through groovy script?
I have created a dynamic text-box though Active choices Reactive reference parameter.我通过 Active choices Reactive 参考参数创建了一个动态文本框。 I want to parse the content that user enters in this dynamic textbox to the build section of the Jenkins.
我想将用户在此动态文本框中输入的内容解析到 Jenkins 的构建部分。
Below is what I have done till now以下是我到目前为止所做的
When the User selects "City" as input a textbox populates as shown below当用户选择“城市”作为输入时,会填充一个文本框,如下所示
Below is the groovy script used to populate the dynamic input box下面是用于填充动态输入框的 groovy 脚本
if (Country.equals("City")) {
html=
'''<!DOCTYPE HTML>
<input type = "text"
id = "myText"
/>
</p>
</html>
'''
return html
}
else
{
return ["Invalid"]
}
I want to parse the content "Delhi" to build section of Jenkins.I have tried ${path} or $path, $html, $id but it is not accessible.我想解析内容“Delhi”以构建 Jenkins 的部分。我尝试了 ${path} 或 $path, $html, $id 但它不可访问。
Can someone please help?有人可以帮忙吗?
Finally got the solution终于得到解决方案
Code snippet代码片段
if (Country.equals("city")) {
html=
'''
<p>
<input type = "text" id = "myText" name="value" >
</p>
<hr>
'''
return html
}
else
{
return ["Invalid"]
}
The value passed in the text box path can be directly parsed as $path in the execute shell option.文本框路径中传递的值可以直接解析为execute shell选项中的$path。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.