From 63eb127f7262d5134f2800ab6f32e656b64fe608 Mon Sep 17 00:00:00 2001 From: Matt Rendina Date: Wed, 28 Nov 2018 14:40:02 -0500 Subject: Simplify iteration over configs and avoid bug exercised by position of (#23) JobConfig object in the list of items passed to run() function. --- vars/utils.groovy | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'vars/utils.groovy') diff --git a/vars/utils.groovy b/vars/utils.groovy index 50d17df..d6ee25c 100644 --- a/vars/utils.groovy +++ b/vars/utils.groovy @@ -229,18 +229,17 @@ def test_summary_notify(single_issue) { // Test for type of list object and parse attributes accordingly. def run(configs, concurrent = true) { - // Split off any JobConfig object, leaving the config objects. - def ljobconfig = new JobConfig() // Set default values. + // Create JobConfig with default values. + def ljobconfig = new JobConfig() + + def tasks = [:] configs.eachWithIndex { config, index -> + + // Extract a JobConfig object if one is found. if (config.getClass() == JobConfig) { ljobconfig = config - configs.remove(configs.indexOf(config)) return // effectively a 'continue' from within a closure. } - } - - def tasks = [:] - configs.eachWithIndex { config, index -> def BuildConfig myconfig = new BuildConfig() // MUST be inside eachWith loop. myconfig = SerializationUtils.clone(config) -- cgit