您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Jenkins在不同的代理上并行构建

Jenkins在不同的代理上并行构建

从本文档中可以这样进行:

// Creation of the stage_list
def stage_list = ["Windows", "Linux"]

// Creation of a map of stages
def stepsForParallel = stage_list.collectEntries {
    ["echoing ${it}" : transformIntoStage(it)]
}

// Run the stages in parallel
parallel stepsForParallel

// Creation of the stage
def transformIntoStage(inputString) {
    return {
        stage (inputString) {
            steps {
                echo "TEST "+inputString
            }
        }
    }
}

您可以在此处找到有关并行Jenkins声明式管道的更多信息。

为什么它一起工作stepsscript,但没有他们?

根据本文档,我认为parallel与列表一起使用是 方法(在Declarative Pipeline 1.2之前),该方法要求在Declarative Pipeline中使用Scripted Pipeline。

似乎新方法parallel(来自Declarative Pipeline 1.2)不能与列表一起使用。因此,要执行此操作,必须使用 旧的 Scripted Pipeline方法,因此,您需要封装自己的命令pipeline stage_listscript而该命令本身必须由封装steps

您可以@L_404_3@找到有关脚本化管道和声明性管道的更多信息。

其他 2022/1/1 18:14:46 有635人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶