Jenkins管道常规构建步骤-动态传递值

时间:2020-04-24 08:19:14

标签: jenkins jenkins-pipeline jenkins-groovy

我正在尝试通过Jenkins Pipeline自动执行构建扫描器(Acunetix)步骤,并且需要将BuildScanner的输入作为变量发送:

id="abdcefg"
step([$class: 'BuildScanner', incScan: false, incScanId: '', profile: '11111111-1111-1111-1111-111111111111', stopScan: true, svRep: true, target: $id, threat: 'DoNotFail'])

常规构建步骤不会动态获取参数,或者有其他方法可以实现此目的吗?

1 个答案:

答案 0 :(得分:0)

参数前面的$符号是错误。仅在字符串内插时才需要,而在直接使用变量时则不需要。

target: $id

这应该有效:

id="abdcefg" 
step([$class: 'BuildScanner', incScan: false, incScanId: '', profile: '11111111-1111-1111-1111-111111111111', stopScan: true, svRep: true, target: id, threat: 'DoNotFail'])
相关问题