如何在多台机器上并行运行相同的jenkins作业

时间:2017-12-01 13:38:55

标签: jenkins parallel-processing jobs

我有两台构建机器设置为32位版本和64位版本的相同代码。 由于代码相同,只有参数值不同。

我已经为编译和参数创建了一个作业来判断是32位还是64位。

如何在两个节点上同时运行相同的作业?

已经有一个帖子:How to run the same job multiple times in parallel with Jenkins?

但它指的是在同一台机器上多次运行相同的作业。

但我的是要在不同的机器上多次运行。

3 个答案:

答案 0 :(得分:0)

点击复选框"限制项目运行的位置"在工作配置中 并提到奴隶节点: 参考:http://www.infobeans.com/opensourceblog/miscellaneous/jenkins-master-slave-configuration/ 该文档的底部解释了它

答案 1 :(得分:0)

如果您使用的是Pipeline,则可以向代理添加Label,即32位和64位。

在您的管道声明中,将其添加到节点定义:

parallel(
        [
         "Build with 32bits": { node("32bits") { ... } },
         "Build with 64bits": { node("64bits") { ... } }
        ]
)

答案 2 :(得分:0)

一种方法是使用jenkins管道和构造并行。 e.g:

pipeline {
agent none
stages {
    stage('Run Builds in parallel') {
        parallel {
            stage('Build On Windows') {
                agent {
                    label "windows"
                }
                steps {
                    bat '''
                    echo running on windows
                    '''
                }
            }
            stage('Build On Linux') {
                agent {
                    label "linux"
                }
                steps {
                    sh "echo Hello"
                }
            }
        }
    }
}

}

你可以在幕外调用构建而不是步骤。