Browse Source

Add trigger-with-no-params for join-trigger

Change-Id: I4d4f3b5b4cc22b5f0f26cb6d1f7ee1fb93316e8d
Dawid Malinowski 3 years ago
parent
commit
e757129c7b

+ 4
- 1
jenkins_jobs/modules/publishers.py View File

@@ -263,6 +263,8 @@ def trigger_parameterized_builds(parser, xml_parent, data):
263 263
     :arg str property-file: Use properties from file (optional)
264 264
     :arg bool fail-on-missing: Blocks the triggering of the downstream jobs
265 265
       if any of the files are not found in the workspace (default 'False')
266
+    :arg bool trigger-with-no-params: Trigger a build even when there are
267
+      currently no parameters defined (default 'False')
266 268
     :arg str restrict-matrix-project: Filter that restricts the subset
267 269
         of the combinations that the downstream project will run (optional)
268 270
     :arg str node-label-name: Specify the Name for the NodeLabel parameter.
@@ -364,7 +366,8 @@ def trigger_parameterized_builds(parser, xml_parent, data):
364 366
         condition.text = project_def.get('condition', 'ALWAYS')
365 367
         trigger_with_no_params = XML.SubElement(tconfig,
366 368
                                                 'triggerWithNoParameters')
367
-        trigger_with_no_params.text = 'false'
369
+        trigger_with_no_params.text = str(
370
+            project_def.get('trigger-with-no-params', False)).lower()
368 371
 
369 372
 
370 373
 def trigger(parser, xml_parent, data):

+ 1
- 1
tests/publishers/fixtures/join-trigger001.xml View File

@@ -12,7 +12,7 @@
12 12
               </configs>
13 13
               <projects>archive</projects>
14 14
               <condition>ALWAYS</condition>
15
-              <triggerWithNoParameters>false</triggerWithNoParameters>
15
+              <triggerWithNoParameters>true</triggerWithNoParameters>
16 16
             </hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
17 17
             <hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
18 18
               <configs>

+ 2
- 0
tests/publishers/fixtures/join-trigger001.yaml View File

@@ -8,5 +8,7 @@ publishers:
8 8
         - trigger-parameterized-builds:
9 9
           - project: archive
10 10
             current-parameters: true
11
+            trigger-with-no-params: true
11 12
           - project: cleanup
12 13
             current-parameters: true
14
+            trigger-with-no-params: false

Loading…
Cancel
Save