mat*_*sev 9 jenkins jenkins-pipeline
如何在一个?中使用Jenkins Dynamic PluginJenkinsfile?
我正在寻找的是一个Jenkinsfile片段:
Build with ParametersJenkins作业中的选项Dynamic Choice Parameters并且用户将看到下拉列表.尝试时:
Pipeline syntax 在詹金斯编辑properties: Set job properties为Sample stepThis project is parameterizedDynamic Choice ParameterName,Choice Script,Remote Script等Generate Pipeline Script我得到以下模板:
properties([
parameters([
<object of type com.seitenbau.jenkins.plugins.dynamicparameter.ChoiceParameterDefinition>
]),
pipelineTriggers([])
])
Run Code Online (Sandbox Code Playgroud)
即生成的管道脚本不包含我在5.上面步骤中输入的数据.如何修改parameters以便用户可以看到参数名称,选项等?
Jenkins版本:2.19.3动态参数插件版本:0.2.0
小智 7
Jenkins Dynamic Plugin已经不再需要了.只需使用普通选择或字符串参数,并通过groovy代码更新值.
#!/bin/groovy
def envs = loadEnvs();
properties([
parameters([
choice(choices: envs, description: 'Please select an environment', name: 'Env')
])
])
node {
try {
stage('Preparation'){
...
Run Code Online (Sandbox Code Playgroud)
如果使用choice参数,请注意必须提供一个字符串,其中值由新行分隔.
例如:
"a\nb\nc"
Run Code Online (Sandbox Code Playgroud)
如果你真的需要插件,那么就这个问题投票JENKINS-42149.
| 归档时间: |
|
| 查看次数: |
16345 次 |
| 最近记录: |