Add "every online node" factory to Parameterized Trigger builder

Change-Id: I99cb1d8aa9a0bdd1f0bf1ff5b99efc5333b7a30f
This commit is contained in:
Jeff Grafton 2016-05-25 17:37:03 -07:00
parent 7d13236760
commit 2e8dd52170
5 changed files with 59 additions and 1 deletions

View File

@ -446,6 +446,10 @@ def trigger_builds(parser, xml_parent, data):
* **ignore-offline-nodes** (`bool`) -- Don't trigger build on * **ignore-offline-nodes** (`bool`) -- Don't trigger build on
offline nodes (default true) offline nodes (default true)
:Factory:
* **factory** (`str`) **allonlinenodes** -- Trigger a build on
every online node. Requires NodeLabel Parameter Plugin (optional)
Examples: Examples:
Basic usage with yaml list of projects. Basic usage with yaml list of projects.
@ -545,7 +549,8 @@ def trigger_builds(parser, xml_parent, data):
supported_factories = ['filebuild', supported_factories = ['filebuild',
'binaryfile', 'binaryfile',
'counterbuild', 'counterbuild',
'allnodesforlabel'] 'allnodesforlabel',
'allonlinenodes']
supported_actions = ['SKIP', 'NOPARMS', 'FAIL'] supported_actions = ['SKIP', 'NOPARMS', 'FAIL']
for factory in project_def['parameter-factories']: for factory in project_def['parameter-factories']:
@ -618,6 +623,12 @@ def trigger_builds(parser, xml_parent, data):
'ignoreOfflineNodes') 'ignoreOfflineNodes')
ignoreOfflineNodes.text = str(factory.get( ignoreOfflineNodes.text = str(factory.get(
'ignore-offline-nodes', True)).lower() 'ignore-offline-nodes', True)).lower()
if factory['factory'] == 'allonlinenodes':
params = XML.SubElement(
fconfigs,
'org.jvnet.jenkins.plugins.nodelabelparameter.'
'parameterizedtrigger.'
'AllNodesBuildParameterFactory')
projects = XML.SubElement(tconfig, 'projects') projects = XML.SubElement(tconfig, 'projects')
if isinstance(project_def['project'], list): if isinstance(project_def['project'], list):

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<builders>
<hudson.plugins.parameterizedtrigger.TriggerBuilder>
<configs>
<hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
<configs class="java.util.Collections$EmptyList"/>
<configFactories>
<org.jvnet.jenkins.plugins.nodelabelparameter.parameterizedtrigger.AllNodesBuildParameterFactory/>
</configFactories>
<projects>every-node</projects>
<condition>ALWAYS</condition>
<triggerWithNoParameters>false</triggerWithNoParameters>
<buildAllNodesWithLabel>false</buildAllNodesWithLabel>
<block>
<buildStepFailureThreshold>
<name>FAILURE</name>
<ordinal>2</ordinal>
<color>RED</color>
<completeBuild>true</completeBuild>
</buildStepFailureThreshold>
<unstableThreshold>
<name>UNSTABLE</name>
<ordinal>1</ordinal>
<color>YELLOW</color>
<completeBuild>true</completeBuild>
</unstableThreshold>
<failureThreshold>
<name>FAILURE</name>
<ordinal>2</ordinal>
<color>RED</color>
<completeBuild>true</completeBuild>
</failureThreshold>
</block>
</hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
</configs>
</hudson.plugins.parameterizedtrigger.TriggerBuilder>
</builders>
</project>

View File

@ -0,0 +1,6 @@
builders:
- trigger-builds:
- project: "every-node"
parameter-factories:
- factory: allonlinenodes
block: true

View File

@ -33,6 +33,7 @@
<nodeLabel>labelname</nodeLabel> <nodeLabel>labelname</nodeLabel>
<ignoreOfflineNodes>false</ignoreOfflineNodes> <ignoreOfflineNodes>false</ignoreOfflineNodes>
</org.jvnet.jenkins.plugins.nodelabelparameter.parameterizedtrigger.AllNodesForLabelBuildParameterFactory> </org.jvnet.jenkins.plugins.nodelabelparameter.parameterizedtrigger.AllNodesForLabelBuildParameterFactory>
<org.jvnet.jenkins.plugins.nodelabelparameter.parameterizedtrigger.AllNodesBuildParameterFactory/>
</configFactories> </configFactories>
<projects>build_started</projects> <projects>build_started</projects>
<condition>ALWAYS</condition> <condition>ALWAYS</condition>

View File

@ -19,4 +19,5 @@ builders:
name: parametername name: parametername
node-label: labelname node-label: labelname
ignore-offline-nodes: false ignore-offline-nodes: false
- factory: allonlinenodes
block: true block: true