Jenkins:来自管道的 MatrixCombinationsParameterValue
Jenkins: MatrixCombinationsParameterValue from a pipeline
我想从管道作业开始矩阵构建,但我只想构建一个轴。
我试过这个:
build job: "Build_Android_Matrix", propagate: false, wait: true,
parameters: [[$class: 'StringParameterValue', name: 'branch', value: "$branch"],
[$class: 'BooleanParameterValue', name: 'production', value: true],
[$class: 'BooleanParameterValue', name: 'beta', value: false],
[$class: 'MatrixCombinationsParameterValue', name: 'paramFilter', description: null, combinations: ['buildType=Release']]]
我有 2 个轴,flavor
和 buildType
,paramFilter
是矩阵组合参数。
矩阵构建从所有作业参数开始,但它什么也没构建,因为矩阵组合选择为空。
我也尝试过 ['buildType==Release']
和 ['buildType=="Release"']
,但我总是得到相同的结果。
我也尝试过:
build job: "Build_Android_Matrix", propagate: false, wait: true, parameters: [
new hudson.plugins.matrix_configuration_parameter.MatrixCombinationsParameterValue
("paramFilter",
null,
['buildType=Release'])
]
但它失败了,因为 RejectedAccessException: Scripts not permitted to use new
.
我几乎可以肯定我没有以正确的方式提供组合,但我不知道还能尝试什么。
更新
在 Christopher Orr 回答后,我尝试像这样设置参数:
[$class: 'MatrixCombinationsParameterValue', name: 'paramFilter', description: null, combinations: ['buildType=Release,flavor=Italy']]]
以此为轴:
- 风味:德国意大利墨西哥美国
- buildType:调试版本
并没有工作,因为我忘记了我也有一个从属轴并且也必须指定。
所以这对我有用:
[$class: 'MatrixCombinationsParameterValue', combinations: ["buildType=Release,flavor=Italy,label=android"], description: '', name: 'paramFilter']
当您使用来自网络的 Matrix Combinations 插件时 UI,您需要明确指定您想要 运行 的所有组合。所以在Pipeline中你需要做同样的事情,例如:
combinations: ['buildType=Release,flavor=beta',
'buildType=Release,flavor=production']
参数的顺序很重要。
我想从管道作业开始矩阵构建,但我只想构建一个轴。
我试过这个:
build job: "Build_Android_Matrix", propagate: false, wait: true,
parameters: [[$class: 'StringParameterValue', name: 'branch', value: "$branch"],
[$class: 'BooleanParameterValue', name: 'production', value: true],
[$class: 'BooleanParameterValue', name: 'beta', value: false],
[$class: 'MatrixCombinationsParameterValue', name: 'paramFilter', description: null, combinations: ['buildType=Release']]]
我有 2 个轴,flavor
和 buildType
,paramFilter
是矩阵组合参数。
矩阵构建从所有作业参数开始,但它什么也没构建,因为矩阵组合选择为空。
我也尝试过 ['buildType==Release']
和 ['buildType=="Release"']
,但我总是得到相同的结果。
我也尝试过:
build job: "Build_Android_Matrix", propagate: false, wait: true, parameters: [
new hudson.plugins.matrix_configuration_parameter.MatrixCombinationsParameterValue
("paramFilter",
null,
['buildType=Release'])
]
但它失败了,因为 RejectedAccessException: Scripts not permitted to use new
.
我几乎可以肯定我没有以正确的方式提供组合,但我不知道还能尝试什么。
更新
在 Christopher Orr 回答后,我尝试像这样设置参数:
[$class: 'MatrixCombinationsParameterValue', name: 'paramFilter', description: null, combinations: ['buildType=Release,flavor=Italy']]]
以此为轴:
- 风味:德国意大利墨西哥美国
- buildType:调试版本
并没有工作,因为我忘记了我也有一个从属轴并且也必须指定。
所以这对我有用:
[$class: 'MatrixCombinationsParameterValue', combinations: ["buildType=Release,flavor=Italy,label=android"], description: '', name: 'paramFilter']
当您使用来自网络的 Matrix Combinations 插件时 UI,您需要明确指定您想要 运行 的所有组合。所以在Pipeline中你需要做同样的事情,例如:
combinations: ['buildType=Release,flavor=beta',
'buildType=Release,flavor=production']
参数的顺序很重要。