问题描述
我正在尝试并行运行非矩阵阶段和矩阵阶段。我希望 stage ('Build - Win Mac') & stage ('Build - Linux') 并行运行。根据 https://www.jenkins.io/doc/book/pipeline/syntax/#declarative-matrix “如果该阶段指令嵌套在并行或矩阵块本身中,则不可能在阶段指令中嵌套并行或矩阵块”。所以我正在寻找这种情况的解决方法。请在我的示例阶段下方找到并建议我如何实现这一目标
stages {
stage ('Build') {
stage ('Build - Win Mac') {
// non-docker build for Win & Mac using Matrix
matrix {
axes {
axis {
name 'PLATFORM'
values 'Win','Mac'
}
axis {
name 'ADDRESS_SANITIZER'
values 'disabled','enabled'
}
}
stage ('build'){
steps {
// build step for win,mac
}
}
}
stage ('Build - Linux'){
// docker build for Linux
}
}
}
解决方法
我不能用纯声明式管道来实现,但如果你混合声明式 + 脚本式,这是可能的
pipeline {
agent {
label {
label 'EB_TEST_SEL'
customWorkspace "/home/jenkins/workspace/ReleaseBuild/${BUILD_NUMBER}/"
}
}
}