依次运行Jenkins并行任务

编程入门 行业动态 更新时间:2024-10-23 15:28:53
本文介绍了依次运行Jenkins并行任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在编写一个新的Jenkins管道,并具有一组最终要并行运行的步骤.但是,在开发此管道时,我想强制其顺序运行.我没有看到任何指定并行步骤使用的线程数或类似方法的方法.这是到目前为止的基本代码:

I'm writing a new Jenkins pipeline and have a set of steps that I would eventually like to run in parallel. But while I'm developing this pipeline I'd like to force it to run sequentially. I'm not seeing any way to specify the number of threads a parallel step uses or anything like that. Here is the basic code so far:

node('x') { stage('cleanup'){ def cleanupScripts = [:] cleanupScripts[1] = { sh(script: "cleanup1.sh") } cleanupScripts[2] = { sh(script: "cleanup2.sh") } cleanupScripts[3] = { sh(script: "cleanup3.sh") } cleanupScripts[4] = { sh(script: "cleanup4.sh") } parallel cleanupScripts } }

我希望能够依次运行这些Shell脚本而无需更改大量代码.

I'd like to be able to run those shell scripts sequentially without changing a lot of code.

推荐答案

您可以像这样使用parallel cleanupScripts代替:

Instead of parallel cleanupScripts you can use like this:

cleanupScripts.each{ key, value -> value() }

更多推荐

依次运行Jenkins并行任务

本文发布于:2023-11-24 04:23:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1623955.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Jenkins

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!