1

I have jenkins setup with 2 separate nodes. I also have a parent job that calls multiple jobs. One of these jobs is called multiple times during the build of the parent job (it does some cleaning for the workspaces between the rest of the jobs).

I would like to know if it's possible to dynamically tie builds of this job to specific node?

As I mentioned the job cleans the workspaces and obviously I need that to be done on both nodes during the build of the parent job. I also don't want to create 2 separate jobs that does the exact same thing and the only difference is the checkbox that statically ties each to different nodes. Is there a solution to my problem?

4

2 回答 2

2

考虑添加节点标签插件和参数

这将使“标签”作为参数。您可以通过小逻辑来传递此参数。

于 2015-09-06T04:46:03.310 回答
0

使用Workflow 插件可以更简洁地完成此类专门任务。

node('first') {
  sh 'rm -rf *' // or when 1.11 released: deleteDir()
  // more work…
}
node('second') {
  sh 'rm -rf *'
  // …
}

或者您可以使用该parallel步骤同时运行这些东西,等等。

You can also use build to start builds of other projects in various ways, though you then lose the advantage of being able to see the entire process in one script, and you may also lose control of the exact workspace being used by the downstream build (especially if it is marked concurrent-capable).

于 2015-09-11T13:36:59.813 回答