作者:癫逼 | 来源:互联网 | 2023-02-01 13:32
我尝试使用Jenkins实施我的第一个声明式管道,以便也可以将作业的参数定义置于SCM下。
我想转移具有扩展选择参数的现有工作。不幸的是,我无法将其添加到脚本的parameters {...}部分。
在插件页面上: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]
不幸的是,这对我不起作用。“输入请求”给出了一个未指定的错误。虽然我可以使用“输入消息”解决方案,但是这并不是我最初想要的。我想像已经提到的那样将此参数添加到参数部分。但是我找不到任何描述它的地方。任何建议如何进行,或者还有其他方法/插件?