Extend multijob build step with "execution-type" option

Currently multijob build step has no support for executionType
parameter added in 1.22 version of Multijob plugin.
This parameter allows to specify strategy for triggering build steps
inside multijob stage and this strategy could be parallel (which
is default and only supported version) or sequental.
This patch fixes this problem and adds corresponding parameter
"execution-type" for such build step.

Change-Id: Ie139da844a64b1591b05ccacb7e107fa07bd218a
This commit is contained in:
Andrey Kostrov 2017-07-13 18:13:40 +03:00
parent d53b29169b
commit 8ae85cdb4d
3 changed files with 15 additions and 1 deletions

View File

@ -1802,6 +1802,10 @@ def multijob(registry, xml_parent, data):
:arg str condition: when to trigger the other job.
Can be: 'SUCCESSFUL', 'UNSTABLE', 'COMPLETED', 'FAILURE', 'ALWAYS'.
(default 'SUCCESSFUL')
:arg str execution-type: Define how to run jobs in a phase:
sequentially or parallel.
Can be: 'PARALLEL', 'SEQUENTIALLY'
(default 'PARALLEL')
:arg list projects: list of projects to include in the MultiJob phase
@ -1849,10 +1853,13 @@ def multijob(registry, xml_parent, data):
'MultiJobBuilder')
conditions_available = ('SUCCESSFUL', 'UNSTABLE', 'COMPLETED', 'FAILURE',
'ALWAYS')
job_execution_type_available = ('PARALLEL', 'SEQUENTIALLY')
mapping = [
('name', 'phaseName', None),
('condition', 'continuationCondition',
'SUCCESSFUL', conditions_available)]
'SUCCESSFUL', conditions_available),
('execution-type', 'executionType',
'PARALLEL', job_execution_type_available)]
convert_mapping_to_xml(builder, data, mapping, fail_required=True)
phaseJobs = XML.SubElement(builder, 'phaseJobs')

View File

@ -4,6 +4,7 @@
<com.tikal.jenkins.plugins.multijob.MultiJobBuilder>
<phaseName>PhaseOne</phaseName>
<continuationCondition>SUCCESSFUL</continuationCondition>
<executionType>PARALLEL</executionType>
<phaseJobs>
<com.tikal.jenkins.plugins.multijob.PhaseJobsConfig>
<jobName>PhaseOneJobA</jobName>
@ -37,6 +38,7 @@
<com.tikal.jenkins.plugins.multijob.MultiJobBuilder>
<phaseName>PhaseTwo</phaseName>
<continuationCondition>UNSTABLE</continuationCondition>
<executionType>SEQUENTIALLY</executionType>
<phaseJobs>
<com.tikal.jenkins.plugins.multijob.PhaseJobsConfig>
<jobName>PhaseTwoJobA</jobName>
@ -69,6 +71,7 @@
<com.tikal.jenkins.plugins.multijob.MultiJobBuilder>
<phaseName>PhaseThree</phaseName>
<continuationCondition>ALWAYS</continuationCondition>
<executionType>PARALLEL</executionType>
<phaseJobs>
<com.tikal.jenkins.plugins.multijob.PhaseJobsConfig>
<jobName>PhaseThreeJobA</jobName>
@ -83,6 +86,7 @@
<com.tikal.jenkins.plugins.multijob.MultiJobBuilder>
<phaseName>PhaseFour</phaseName>
<continuationCondition>SUCCESSFUL</continuationCondition>
<executionType>PARALLEL</executionType>
<phaseJobs>
<com.tikal.jenkins.plugins.multijob.PhaseJobsConfig>
<jobName>PhaseFourJobA</jobName>

View File

@ -2,6 +2,7 @@ builders:
- multijob:
name: PhaseOne
condition: SUCCESSFUL
execution-type: PARALLEL
projects:
- name: PhaseOneJobA
current-parameters: true
@ -15,6 +16,7 @@ builders:
- multijob:
name: PhaseTwo
condition: UNSTABLE
execution-type: SEQUENTIALLY
projects:
- name: PhaseTwoJobA
current-parameters: true
@ -34,6 +36,7 @@ builders:
kill-phase-on: FAILURE
- multijob:
name: PhaseFour
execution-type: PARALLEL
projects:
- name: PhaseFourJobA
retry: