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

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

问题描述

下面是我的流水线脚本

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.

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

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