triggered-builds: Support property file injection

Change-Id: I31091977560eabf5656aaa8706de5410d86d5caf
This commit is contained in:
Victor Boivie 2014-04-02 16:40:08 +02:00
parent 72c02d4106
commit a2756a0038
3 changed files with 53 additions and 0 deletions

View File

@ -264,6 +264,8 @@ def trigger_builds(parser, xml_parent, data):
:arg str project: the Jenkins project to trigger
:arg str predefined-parameters:
key/value pairs to be passed to the job (optional)
:arg str property-file:
Pass properties from file to the other job (optional)
:arg bool current-parameters: Whether to include the
parameters passed to the current build to the
triggered job.
@ -296,6 +298,14 @@ def trigger_builds(parser, xml_parent, data):
XML.SubElement(tconfigs,
'hudson.plugins.parameterizedtrigger.'
'SubversionRevisionBuildParameters')
if 'property-file' in project_def:
params = XML.SubElement(tconfigs,
'hudson.plugins.parameterizedtrigger.'
'FileBuildParameters')
propertiesFile = XML.SubElement(params, 'propertiesFile')
propertiesFile.text = project_def['property-file']
failOnMissing = XML.SubElement(params, 'failTriggerOnMissing')
failOnMissing.text = 'true'
if 'predefined-parameters' in project_def:
params = XML.SubElement(tconfigs,
'hudson.plugins.parameterizedtrigger.'

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<builders>
<hudson.plugins.parameterizedtrigger.TriggerBuilder>
<configs>
<hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
<configs>
<hudson.plugins.parameterizedtrigger.FileBuildParameters>
<propertiesFile>propfile.txt</propertiesFile>
<failTriggerOnMissing>true</failTriggerOnMissing>
</hudson.plugins.parameterizedtrigger.FileBuildParameters>
</configs>
<projects>build_started</projects>
<condition>ALWAYS</condition>
<triggerWithNoParameters>false</triggerWithNoParameters>
<buildAllNodesWithLabel>false</buildAllNodesWithLabel>
<block>
<buildStepFailureThreshold>
<name>FAILURE</name>
<ordinal>2</ordinal>
<color>RED</color>
</buildStepFailureThreshold>
<unstableThreshold>
<name>UNSTABLE</name>
<ordinal>1</ordinal>
<color>YELLOW</color>
</unstableThreshold>
<failureThreshold>
<name>FAILURE</name>
<ordinal>2</ordinal>
<color>RED</color>
</failureThreshold>
</block>
</hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
</configs>
</hudson.plugins.parameterizedtrigger.TriggerBuilder>
</builders>
</project>

View File

@ -0,0 +1,5 @@
builders:
- trigger-builds:
- project: "build_started"
property-file: propfile.txt
block: true