如何在詹金斯的管道中添加后期构建操作
问题描述:
下面是我的管道脚本
node(Slave01) {
currentBuild.displayName = "${URL_Name}"
}
stage 'Pt2ctf process'
node(Slave01) {
build job: 'Pt2ctf_16_7', parameters: [string(name: 'URL_Name', value: "${URL_name}"), string(name: 'Display_Name', value: "${Display_Name}")]
}
stage 'add_fields'
node(Slave01) {
build job: 'add_fields_16_7', parameters: [string(name: 'URL_Name', value: "${URL_Name}")]
}
上面的groovy脚本将依次触发多个构建.序列完成后,我将运行另一个构建.我在管道作业配置中看不到任何构建后选项.
The above groovy script would trigger multiple builds in sequence. I have another build to be run once the sequence is completed. I don't see any post build option in the pipeline job configuration.
是否有可能我们再添加几行,如下所示:
Is it possible that we can add few more lines like below:
post
node(Slave01){
build job: 'testing_build'
}
或者我们还有其他选择吗?请建议
Or do we have any other option? please suggest
答
在使用声明性管道的情况下,只需将post
操作添加到管道脚本中即可.
在管道语法参考中进行了解释.
You can simply add post
action to your pipeline script, in case of using declarative pipeline.
It is explained in Pipeline syntax reference.