diff --git a/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/MultiJobStepContext.groovy b/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/MultiJobStepContext.groovy index e2e1e6a36..5f24d1ae4 100644 --- a/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/MultiJobStepContext.groovy +++ b/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/MultiJobStepContext.groovy @@ -49,7 +49,9 @@ class MultiJobStepContext extends StepContext { stepNodes << new NodeBuilder().'com.tikal.jenkins.plugins.multijob.MultiJobBuilder' { phaseName phaseContext.phaseName delegate.continuationCondition(phaseContext.continuationCondition) - delegate.executionType(phaseContext.executionType) + if (jobManagement.isMinimumPluginVersionInstalled('jenkins-multijob-plugin', '1.22')) { + delegate.executionType(phaseContext.executionType) + } phaseJobs { phaseContext.jobsInPhase.each { PhaseJobContext jobInPhase -> Node phaseJobNode = 'com.tikal.jenkins.plugins.multijob.PhaseJobsConfig' { diff --git a/job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/step/MultiJobStepContextSpec.groovy b/job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/step/MultiJobStepContextSpec.groovy index 9c4fe75a1..26363b497 100644 --- a/job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/step/MultiJobStepContextSpec.groovy +++ b/job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/step/MultiJobStepContextSpec.groovy @@ -17,10 +17,9 @@ class MultiJobStepContextSpec extends Specification { then: with(context.stepNodes[0]) { name() == 'com.tikal.jenkins.plugins.multijob.MultiJobBuilder' - children().size() == 4 + children().size() == 3 phaseName[0].value() == 'First' continuationCondition[0].value() == 'SUCCESSFUL' - executionType[0].value() == 'PARALLEL' phaseJobs[0].value().empty } @@ -33,10 +32,9 @@ class MultiJobStepContextSpec extends Specification { then: with(context.stepNodes[1]) { name() == 'com.tikal.jenkins.plugins.multijob.MultiJobBuilder' - children().size() == 4 + children().size() == 3 phaseName[0].value() == 'Second' continuationCondition[0].value() == 'SUCCESSFUL' - executionType[0].value() == 'PARALLEL' phaseJobs[0].children().size() == 1 with(phaseJobs[0].'com.tikal.jenkins.plugins.multijob.PhaseJobsConfig'[0]) { children().size() == 7 @@ -62,10 +60,9 @@ class MultiJobStepContextSpec extends Specification { then: with(context.stepNodes[0]) { name() == 'com.tikal.jenkins.plugins.multijob.MultiJobBuilder' - children().size() == 4 + children().size() == 3 phaseName[0].value() == 'Third' continuationCondition[0].value() == 'SUCCESSFUL' - executionType[0].value() == 'PARALLEL' phaseJobs[0].children().size() == 3 phaseJobs[0].'com.tikal.jenkins.plugins.multijob.PhaseJobsConfig'[0].jobName[0].value() == 'JobA' phaseJobs[0].'com.tikal.jenkins.plugins.multijob.PhaseJobsConfig'[1].jobName[0].value() == 'JobB' @@ -103,10 +100,9 @@ class MultiJobStepContextSpec extends Specification { then: with(context.stepNodes[0]) { - children().size() == 4 + children().size() == 3 phaseName[0].value() == 'Fourth' continuationCondition[0].value() == 'SUCCESSFUL' - executionType[0].value() == 'PARALLEL' phaseJobs[0].children().size() == 1 with(phaseJobs[0].'com.tikal.jenkins.plugins.multijob.PhaseJobsConfig'[0]) { children().size() == 8 @@ -192,10 +188,9 @@ class MultiJobStepContextSpec extends Specification { then: with(context.stepNodes[0]) { name() == 'com.tikal.jenkins.plugins.multijob.MultiJobBuilder' - children().size() == 4 + children().size() == 3 phaseName[0].value() == 'Second' continuationCondition[0].value() == 'SUCCESSFUL' - executionType[0].value() == 'PARALLEL' phaseJobs[0].children().size() == 1 with(phaseJobs[0].'com.tikal.jenkins.plugins.multijob.PhaseJobsConfig'[0]) { children().size() == 7 @@ -232,20 +227,17 @@ class MultiJobStepContextSpec extends Specification { thrown(DslScriptException) } - def 'call phase with unsupported execution type'(String execution) { + def 'call phase with unsupported execution type'() { setup: jobManagement.isMinimumPluginVersionInstalled('jenkins-multijob-plugin', '1.22') >> true when: context.phase('test') { - executionType execution + executionType 'FOO' } then: thrown(DslScriptException) - - where: - execution << ['FOO'] } def 'call phase with supported condition'(String condition) { @@ -290,7 +282,7 @@ class MultiJobStepContextSpec extends Specification { } where: - execution << ['SEQUENTIALLY'] + execution << ['PARALLEL', 'SEQUENTIALLY'] } def 'phase works inside conditionalSteps'() {