看了半天的 pipeline 的语法,最后自己摸索到解决办法了,与各位分享一下,加了一个 when 就可以完美解决啦
//robotframework excute
stage('robotframework excute'){
when{
expression{return envFlag != null}
}
steps{
script{
sh "pybot 此处省略"
}
step([$class: 'RobotPublisher',
disableArchiveOutput: false,
logFileName: 'log.html',
otherFiles: '',
outputFileName: 'output.xml',
outputPath: './report',
passThreshold: 100,
reportFileName: 'report.html',
unstableThreshold: 0])
}
}