如何在詹金斯的管道中添加后期构建操作 [英] How to add a post build action in the pipeline in Jenkins

查看:860
本文介绍了如何在詹金斯的管道中添加后期构建操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的管道脚本

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.

这篇关于如何在詹金斯的管道中添加后期构建操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆