jenkins - 无法在 Jenkins 的活动选择参数中打印格式化 HTML 的用户输入值
问题描述
我一直在尝试使用主动选择参数来捕获用户从詹金斯输入的值。下面是我的片段
if(DB_CREATION.equals("yes")){
FullHTML = """
<p>
<label style="left: 22% position: absolute;">IP</label>
<input name='IP' type='text' class="setting-input" name="value"> </input> <br></p>
<p>
<label style="left: 22% position: absolute;">USERNAME</label>
<input name='USERNAME' type='text' class="setting-input" name="value"> </input><br>
</p>
<p>
<label style="left: 22% position: absolute;">PASSWORD</label>
<input name='PASSWORD' type='text' class="setting-input" name="value"> </input><br>
</p>
<p>
<label style="left: 22% position: absolute;">DB_NAME</label>
<input name='DB_NAME' type='text' class="setting-input" name="value"> </input><br>
</p>
<p>
<label style="left: 22% position: absolute;">DB_PASSWORD</label>
<input name='DB_PASSWORD' type='text' class="setting-input" name="value"> </input><br>
</p>
"""
return FullHTML }
else if(DB_CREATION.equals("no")){
FullHTML = """
<p>
<label style="left: 22% position: absolute;">IP</label>
<input name='IP' type='text' class="setting-input" name="value"> </input> <br></p>
<p>
<label style="left: 22% position: absolute;">USERNAME</label>
<input name='USERNAME' type='text' class="setting-input" name="value"> </input><br>
</p>
<p>
<label style="left: 22% position: absolute;">PASSWORD</label>
<input name='PASSWORD' type='text' class="setting-input" name="value"> </input><br>
</p>
"""
return FullHTML
}
管道片段如下所示 -
[$class: 'DynamicReferenceParameter', choiceType: 'ET_FORMATTED_HTML', description: '', name: 'PARAMETERS', omitValueField: false, randomName: 'choice-parameter-20993075376134551', referencedParameters: 'DB_CREATION', script: [$class: 'GroovyScript', fallbackScript: [classpath: [], sandbox: false, script: 'return[\'Would not be possible to Proceed Further\']'], script: [classpath: [], sandbox: false, script: '''if(DB_CREATION.equals("yes")){
FullHTML = """
<p>
<label style="left: 22% position: absolute;">IP</label>
<input name=\'IP\' type=\'text\' class="setting-input" name="value"> </input> <br></p>
<p>
<label style="left: 22% position: absolute;">USERNAME</label>
<input name=\'USERNAME\' type=\'text\' class="setting-input" name="value"> </input><br>
</p>
<p>
<label style="left: 22% position: absolute;">PASSWORD</label>
<input name=\'PASSWORD\' type=\'text\' class="setting-input" name="value"> </input><br>
</p>
<p>
<label style="left: 22% position: absolute;">DB_NAME</label>
<input name=\'MC_DB_NAME\' type=\'text\' class="setting-input" name="value"> </input><br>
</p>
<p>
<label style="left: 22% position: absolute;">DB_PASSWORD</label>
<input name=\'MC_DB_PASSWORD\' type=\'text\' class="setting-input" name="value"> </input><br>
</p>
"""
return FullHTML }
else if(DB_CREATION.equals("no")){
FullHTML = """
<p>
<label style="left: 22% position: absolute;">IP</label>
<input name=\'IP\' type=\'text\' class="setting-input" name="value"> </input> <br></p>
<p>
<label style="left: 22% position: absolute;">USERNAME</label>
<input name=\'USERNAME\' type=\'text\' class="setting-input" name="value"> </input><br>
</p>
<p>
<label style="left: 22% position: absolute;">PASSWORD</label>
<input name=\'PASSWORD\' type=\'text\' class="setting-input" name="value"> </input><br>
</p>
"""
return FullHTML
}''']]]
我正在尝试像下面这样打印-(可能的打印)-
echo '${params.FullHTML}'
echo '${params.PARAMETERS}'
echo "${params.PARAMETERS}"
echo "${params.FullHTML}"
我正在尝试像上面那样打印所有都传递空值或什么都不传递。如何提取用户输入并将它们传递给我的测试套件?
解决方案
推荐阅读
- javascript - 类似 iPhoneX 的拖拽显示/隐藏菜单/容器
- ios - 使用 CoreData 和依赖注入 - 线程 1:致命错误:init(coder:) 尚未实现
- javascript - 上传前验证音频文件的持续时间
- jhipster - 与 jHipster 的组合关系
- java - 在 Hibernate 中,当对象已存在于数据库中时,为什么 saveOrUpdate 会给出异常
- android - TextView 将多个字符串设置为一个 setText(int resid)
- javascript - 为什么在条件内调用此函数不起作用?
- javascript - 拖放以交换输入字段
- sql - DateAdd 在没有时间戳的列中插入
- terraform - 使用 -var-file 标志时 terraform 解析 tfvars 文件时出错