Add trigger-from-child-projects option.

Update trigger-parameterized-job arguments, to include
trigger from child projects.

Closes-Bug: story/2002157
Change-Id: Iae0610ee942dd2cad95e3fcaa8b70b16f42b3c50
This commit is contained in:
Tomas Hartmann 2018-06-07 14:03:31 +02:00 committed by Tomas Hartmann
parent 8626df2322
commit ff2d631d1a
16 changed files with 156 additions and 0 deletions

View File

@ -507,6 +507,8 @@ def trigger_parameterized_builds(registry, xml_parent, data):
if any of the property files are not found in the workspace.
Only valid when 'property-file' is specified.
(default 'False')
:arg bool trigger-from-child-projects: Trigger build from child projects.
Used for matrix projects. (default 'False')
:arg bool use-matrix-child-files: Use files in workspaces of child
builds (default 'False')
:arg str matrix-child-combination-filter: A Groovy expression to filter
@ -560,6 +562,10 @@ def trigger_parameterized_builds(registry, xml_parent, data):
condition = XML.SubElement(tconfig, 'condition')
condition.text = project_def.get('condition', 'ALWAYS')
trigger_from_child_projects = XML.SubElement(
tconfig, 'triggerFromChildProjects')
trigger_from_child_projects.text = str(
project_def.get('trigger-from-child-projects', False)).lower()
trigger_with_no_params = XML.SubElement(tconfig,
'triggerWithNoParameters')
trigger_with_no_params.text = str(

View File

@ -12,6 +12,7 @@
</configs>
<projects>archive</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>true</triggerFromChildProjects>
<triggerWithNoParameters>true</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
@ -20,6 +21,7 @@
</configs>
<projects>cleanup</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>

View File

@ -8,6 +8,7 @@ publishers:
- trigger-parameterized-builds:
- project: archive
current-parameters: true
trigger-from-child-projects: true
trigger-with-no-params: true
- project: cleanup
current-parameters: true

View File

@ -7,6 +7,7 @@
<configs class="java.util.Collections$EmptyList"/>
<projects>fixture</projects>
<condition>SUCCESS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>

View File

@ -11,6 +11,7 @@
</configs>
<projects>fixture</projects>
<condition>SUCCESS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>

View File

@ -16,6 +16,7 @@
</configs>
<projects>another_job</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
@ -31,6 +32,7 @@
</configs>
<projects>yet_another_job</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>

View File

@ -13,6 +13,7 @@ bar=foo
</configs>
<projects>other_job,foo,bar</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
@ -30,6 +31,7 @@ bar=foo
</configs>
<projects>other_job1, other_job2</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
@ -46,6 +48,7 @@ bar=foo
</configs>
<projects>yet_another_job</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
@ -57,6 +60,7 @@ bar=foo
</configs>
<projects>yet_another_job_2</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
@ -68,6 +72,7 @@ bar=foo
</configs>
<projects>yet_another_job_3</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
@ -77,6 +82,7 @@ bar=foo
</configs>
<projects>test-project-same-node</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>

View File

@ -12,6 +12,7 @@
</configs>
<projects>test-project-all</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
@ -23,6 +24,7 @@
</configs>
<projects>test-project-just-name</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
@ -34,6 +36,7 @@
</configs>
<projects>test-project-just-node</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>

View File

@ -31,6 +31,7 @@
</configs>
<projects>other_job,foo,bar</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>

View File

@ -15,6 +15,7 @@
</configs>
<projects>other_job</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>

View File

@ -15,6 +15,7 @@
</configs>
<projects>other_job</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>

View File

@ -22,6 +22,7 @@
</configs>
<projects/>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>
@ -54,6 +55,7 @@
</configs>
<projects>experimental_p2_bar</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>
@ -86,6 +88,7 @@
</configs>
<projects>production_p1_foo</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>
@ -118,6 +121,7 @@
</configs>
<projects/>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>

View File

@ -33,6 +33,7 @@ print(&quot;Doing something cool with python&quot;)
</configs>
<projects>default_job</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>
@ -52,6 +53,7 @@ print(&quot;Doing something cool with python&quot;)
</configs>
<projects>first_job</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
@ -67,6 +69,7 @@ print(&quot;Doing something cool with python&quot;)
</configs>
<projects>second_job</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>
@ -110,6 +113,7 @@ print(&quot;Doing something cool with python&quot;)
</configs>
<projects>default_job</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>
@ -129,6 +133,7 @@ print(&quot;Doing something cool with python&quot;)
</configs>
<projects>1.2_first_job</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
@ -144,6 +149,7 @@ print(&quot;Doing something cool with python&quot;)
</configs>
<projects>1.2_second_job</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>

View File

@ -30,6 +30,7 @@
</configs>
<projects/>
<condition>UNSTABLE_OR_BETTER</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>
@ -70,6 +71,7 @@
</configs>
<projects/>
<condition>UNSTABLE_OR_BETTER</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<matrix-project>
<executionStrategy class="hudson.matrix.DefaultMatrixExecutionStrategyImpl">
<runSequentially>false</runSequentially>
</executionStrategy>
<combinationFilter/>
<axes>
<hudson.matrix.TextAxis>
<name>foo_bar</name>
<values>
<string>foo</string>
<string>bar</string>
</values>
</hudson.matrix.TextAxis>
</axes>
<actions/>
<description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
<keepDependencies>false</keepDependencies>
<displayName>JJB Test1</displayName>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<concurrentBuild>false</concurrentBuild>
<canRoam>true</canRoam>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<builders/>
<publishers>
<hudson.plugins.parameterizedtrigger.BuildTrigger>
<configs>
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<configs class="java.util.Collections$EmptyList"/>
<projects>foo</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>true</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>
</hudson.plugins.parameterizedtrigger.BuildTrigger>
</publishers>
<buildWrappers/>
</matrix-project>
<BLANKLINE>
<?xml version="1.0" encoding="utf-8"?>
<matrix-project>
<executionStrategy class="hudson.matrix.DefaultMatrixExecutionStrategyImpl">
<runSequentially>false</runSequentially>
</executionStrategy>
<combinationFilter/>
<axes>
<hudson.matrix.TextAxis>
<name>foo_bar</name>
<values>
<string>foo</string>
<string>bar</string>
</values>
</hudson.matrix.TextAxis>
</axes>
<actions/>
<description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
<keepDependencies>false</keepDependencies>
<displayName>JJB Test2</displayName>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<concurrentBuild>false</concurrentBuild>
<canRoam>true</canRoam>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<builders/>
<publishers>
<hudson.plugins.parameterizedtrigger.BuildTrigger>
<configs>
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
<configs class="java.util.Collections$EmptyList"/>
<projects>foo</projects>
<condition>ALWAYS</condition>
<triggerFromChildProjects>false</triggerFromChildProjects>
<triggerWithNoParameters>false</triggerWithNoParameters>
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
</configs>
</hudson.plugins.parameterizedtrigger.BuildTrigger>
</publishers>
<buildWrappers/>
</matrix-project>

View File

@ -0,0 +1,36 @@
- project:
name: trigger-from-child
jobs:
- 'hydra_{name}_jjb-test1'
- 'hydra_{name}_jjb-test2'
- job-template:
project-type: matrix
axes:
- axis:
type: user-defined
name: foo_bar
values:
- foo
- bar
name: 'hydra_{name}_jjb-test1'
display-name: 'JJB Test1'
publishers:
- trigger-parameterized-builds:
- project: 'foo'
trigger-from-child-projects: true
- job-template:
project-type: matrix
axes:
- axis:
type: user-defined
name: foo_bar
values:
- foo
- bar
name: 'hydra_{name}_jjb-test2'
display-name: 'JJB Test2'
publishers:
- trigger-parameterized-builds:
- project: 'foo'