How to trigger a jenkins build on specific node using pipeline plugin?

前端 未结 4 565
广开言路
广开言路 2020-12-03 10:13

I have a Jenkins pipeline job called \"TestPipeline\". I want to trigger a build on 2 different slaves which labeled \"tester1\' and \"tester2\". And the pipeline script is

4条回答
  •  独厮守ぢ
    2020-12-03 10:43

    Please see the bug here. The solution is as follows.

    1. Install Node and Label parameter plugin
    2. In test_job's configuration, select 'This build is parameterized' and add a Label parameter and set the parameter name to 'node'
    3. In pipeline script, use code:
    build job: 'test_job', parameters: [[$class: 'LabelParameterValue', name: 'node', label: 'tester1']]
    build job: 'test_job', parameters: [[$class: 'LabelParameterValue', name: 'node', label: 'tester2']]
    

    And the job will be built as I wanted.

    However, I think it is only a workaround. I still believe this is a bug. Because the node step should do its job instead of letting other plugins to do for it.

提交回复
热议问题