Allow multiple node selection for 'node' parameter

Change-Id: I6690e5fcfe5169e2fdb6815cfde95e607abb5c42
This commit is contained in:
Sergey Kulanov 2015-01-16 18:25:50 +02:00
parent 4bf020e07e
commit 0547e44129
5 changed files with 53 additions and 3 deletions

@ -187,6 +187,11 @@ def node_param(parser, xml_parent, data):
when job gets triggered manually. Empty means 'All'.
:arg bool ignore-offline-nodes: Ignore nodes not online or not having
executors (default false)
:arg bool allowed-multiselect: Allow multi node selection for concurrent
builds - this option only makes sense (and must be selected!) in
case the job is configured with: "Execute concurrent builds if
necessary". With this configuration the build will be executed on all
the selected nodes in parallel. (default false)
Example:
@ -208,8 +213,16 @@ def node_param(parser, xml_parent, data):
XML.SubElement(pdef, 'ignoreOfflineNodes').text = str(
data.get('ignore-offline-nodes', False)).lower()
XML.SubElement(pdef, 'triggerIfResult').text = \
'multiSelectionDisallowed'
if data.get('allowed-multiselect', False):
XML.SubElement(pdef, 'triggerIfResult').text = \
'allowMultiSelectionForConcurrentBuilds'
else:
XML.SubElement(pdef, 'triggerIfResult').text = \
'multiSelectionDisallowed'
XML.SubElement(pdef, 'allowMultiNodeSelection').text = str(
data.get('allowed-multiselect', False)).lower()
XML.SubElement(pdef, 'triggerConcurrentBuilds').text = str(
data.get('allowed-multiselect', False)).lower()
def choice_param(parser, xml_parent, data):

@ -13,7 +13,9 @@
<string>slave003</string>
</allowedSlaves>
<ignoreOfflineNodes>true</ignoreOfflineNodes>
<triggerIfResult>multiSelectionDisallowed</triggerIfResult>
<triggerIfResult>allowMultiSelectionForConcurrentBuilds</triggerIfResult>
<allowMultiNodeSelection>true</allowMultiNodeSelection>
<triggerConcurrentBuilds>true</triggerConcurrentBuilds>
</org.jvnet.jenkins.plugins.nodelabelparameter.NodeParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>

@ -7,4 +7,5 @@ parameters:
- slave002
- slave003
ignore-offline-nodes: true
allowed-multiselect: true

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<org.jvnet.jenkins.plugins.nodelabelparameter.NodeParameterDefinition>
<name>SLAVE_NAME</name>
<description>Select slave</description>
<defaultSlaves/>
<allowedSlaves>
<string>slave001</string>
<string>slave002</string>
<string>slave003</string>
</allowedSlaves>
<ignoreOfflineNodes>true</ignoreOfflineNodes>
<triggerIfResult>multiSelectionDisallowed</triggerIfResult>
<allowMultiNodeSelection>false</allowMultiNodeSelection>
<triggerConcurrentBuilds>false</triggerConcurrentBuilds>
</org.jvnet.jenkins.plugins.nodelabelparameter.NodeParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
</project>

@ -0,0 +1,11 @@
parameters:
- node:
name: SLAVE_NAME
description: "Select slave"
allowed-slaves:
- slave001
- slave002
- slave003
ignore-offline-nodes: true
allowed-multiselect: false