小编Spr*_*lls的帖子

Jenkins 管道 - 如何动态提供选择参数

pipeline {
  agent any
  stages {
    stage("foo") {
        steps {
            script {
                env.RELEASE_SCOPE = input message: 'User input required', ok: 'Release!',
                        parameters: [choice(name: 'RELEASE_SCOPE', choices: 'patch\nminor\nmajor', 
                                     description: 'What is the release scope?')]
            }
            echo "${env.RELEASE_SCOPE}"
        }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,选择是硬编码的(补丁\nminor\nmajor)——我的要求是在下拉列表中动态给出选择值。我通过调用 api - Artifacts list (.zip) 文件名从 artifactory 中获取值在上面的示例中,它在我们进行构建时请求输入,但我想做一个“带参数的构建”

请对此提出建议/帮助。

jenkins jenkins-pipeline

5
推荐指数
2
解决办法
3万
查看次数

标签 统计

jenkins ×1

jenkins-pipeline ×1