如何为矩阵项目中的每个配置触发作业

时间:2014-01-21 08:08:25

标签: jenkins jenkins-plugins multi-configuration

我必须达到以下目的: 我有一个具有两个配置C1和C2的多配置项目A,现在对于每个成功的配置,我想构建另一个项目B,比如说:

  • 如果C1成功且C2失败则C1->乙
  • 如果C1失败并且C2成功则C2->乙
  • 如果C1成功并且C2成功则C1-> B然后C2 - > B(一次只能运行一个B实例)

目前,如果其中一个配置失败,则父项将被标记为失败,从而停止触发下游项目。

1 个答案:

答案 0 :(得分:0)

您可以使用parameterized trigger plugin在C结尾处触发作业B,并将参数传递给B,这是C中矩阵参数的名称 - 这是以标签名称命名的

对于多个作业B一起运行,如果你保持并发运行,如果需要在作业B中未选中框,那就没问题了


修改

似乎插件支持此原生而不使用参数 - 来自插件页面

Use of the plugin in a Matrix job
Post build task
When using the trigger parameterized build as a post build task for a matrix job the
triggering will be be done
once when all of the different matrix configurations have completed.
In this case some of the Environment variables may not be resolvable as passing them 
to downstream jobs will fail.

Environment variables that should be available are the the default shell ones
(<yourserver:port>/env-vars.html) and ones defined as Parameters.
Variables added by the other plugins as a buildwrappers may not be available.

Build step
When using the trigger parameterized build as a buildstep it will be called for 
every different configuration, so if triggering another project with no parameters it 
will be done the same number of times as you have configurations, possible causing the
triggered job to run more than once.

However this also allows you to trigger other jobs with parameters relating to the 
current configuration, i.e. triggering a build on the same node with the same JDK.