
[英]Jmeter If Controller with Groovy Function containing operator && and || doesn't work
[英]Groovy containsKey function doesn't work properly
首先,当您的管道定义参数时,您可以放心地假设这些键将在那里。 它只对其他人在不知不觉中从参数中删除它们有帮助,即使这样,在按名称访问它们时管道也会失败。
现在,参数在管道中使用关键字parameters
定义,但使用关键字params
访问,例如:
pipeline {
agent any
parameters {
string(name: 'BUNDLE_NAME', defaultValue: '', description: '')
string(name: 'BUNDLE_VERSION', defaultValue: '', description: '')
}
stages {
stage('A') {
steps {
script {
println "BUNDLE_NAME is ${params.BUNDLE_NAME}"
println "BUNDLE_VERSION is " + params.BUNDLE_VERSION
}
}
}
}
}
这是我的错,但对未来的其他人来说是一个教训:管道代码:
stage ("valdation"){
steps{
script{
amd_distribution_check_artifacts_exists credential_id: params.DISTRIBUTION_CREDENTIAL_ID, distribution_url: params.DISTRIBUTION_URL, bundle_name: params.BUNDLE_NAME, bundle_version: BUNDLE_VERSION
}
}
}
我不得不用小写来处理变量
if (!parameters['bundle_name'])
{
echo "mandatory param"
error ("mandatory param")
}
if (!parameters['bundle_version'])
{
echo "mandatory param"
error ("mandatory param")
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.