用于在矩阵上重新运行失败构建的脚本

Script for rerunning failed builds on the matrix

我正在尝试准备脚本以使用 Jenkins Job DSL 插件配置一些作业。它应该准备具有多个轴(大约 50 个轴)和配置选项 "Retry build after failure" 的矩阵作业,但我注意到它不支持所有可用选项。

在作业配置中(手动)我们可以设置:

并且 Jenkins Job DSL 具有:

目前我的脚本是这样的:

publishers {
  retryBuild {
    rerunIfUnstable()
    retryLimit(2)
    fixedDelay(0)
  }
}

不幸的是我无法配置选项:"Rerun build only for failed parts on the matrix"...这是必要的,因为我不想重新运行所有部分,只是因为一个失败。

有办法做到吗?不一定要通过 Job DSL 插件来完成(但当然不能手动完成)。

这个项目的一个特点,有时会导致某些部分失败,所以需要重新运行。

built-in DSL 不支持所有选项。但是 Dynamic DSL 确实:

matrixJob('example') {
  publishers {
    naginatorPublisher {
      regexpForRerun(null)
      rerunIfUnstable(true)
      rerunMatrixPart(true)
      checkRegexp(false)
      maxSchedule(2)
      delay {
        fixedDelay {
          delay(0)
        }  
      }
    } 
  }
}