【发布时间】:2017-06-13 10:31:04
【问题描述】:
我尝试使用 Jenkins 实现我的第一个声明式管道,以便能够将作业的参数定义也放在 SCM 下。
我想转移具有扩展选择参数的现有工作。不幸的是,我无法将其添加到脚本的参数{...} 部分。
在插件页面:https://wiki.jenkins-ci.org/display/JENKINS/Extended+Choice+Parameter+plugin 我发现一条评论说应该可以通过:
import com.cwctravel.hudson.plugins.extended_choice_parameter.ExtendedChoiceParameterDefinition
def type = "PT_JSON"
def groovyScript = null
def propertyValue = null
def projectName = null
def propertyFile = null
def groovyScriptFile = "/path_to/script.groovy"
...
def extendedChoice = new ExtendedChoiceParameterDefinition(name,
type,
propertyValue,
projectName,
propertyFile,
groovyScript,
.....
input message: 'Param1', parameters: [extendedChoice]
不幸的是,这对我不起作用。 “输入请求”给出了一个未指定的错误。虽然我可以接受“输入消息”解决方案,但这并不是我首先要寻找的。如前所述,我想将此参数添加到参数部分。但我找不到任何描述这一点的地方。任何建议如何继续,或者可能还有替代方法/插件?
【问题讨论】: