相关疑难解决方法(0)

管道将参数传递给下游作业

我正在使用Jenkins v2.1和集成的交付管道功能(https://jenkins.io/solutions/pipeline/)来编排两个现有的构建(构建和部署).

在我的参数化构建中,我有3个用户参数设置,也需要在管道中进行选择.

管道脚本如下:

node: {
    stage 'build'
    build job: 'build', parameters: [[$class: 'StringParameterValue', name: 'target', value: target], [$class: 'ListSubversionTagsParameterValue', name: 'release', tag: release], [$class: 'BooleanParameterValue', name: 'update_composer', value: update_composer]]

    stage 'deploy'
    build job: 'deploy', parameters: [[$class: 'StringParameterValue', name: 'target', value: target]]
}
Run Code Online (Sandbox Code Playgroud)

这个工作正常,除了BooleanParameterValue.当我构建管道时,抛出以下错误:

java.lang.ClassCastException: hudson.model.BooleanParameterValue.value expects boolean but received class java.lang.String
Run Code Online (Sandbox Code Playgroud)

如何解决此类型转换错误?或者甚至更好,是否有一种不那么麻烦的方式,我可以将所有管道参数传递给下游作业.

groovy jenkins jenkins-pipeline

52
推荐指数
5
解决办法
8万
查看次数

标签 统计

groovy ×1

jenkins ×1

jenkins-pipeline ×1