From cd7b8b4d8d0c7ec1ad23ea47c01340c544eb9efc Mon Sep 17 00:00:00 2001 From: Matt Rendina Date: Tue, 12 Jun 2018 10:31:16 -0400 Subject: Allow for transition to new BuildConfig property name: BuildConfig.build_mode --> BuildConfig.name NOTE: ALL instances of .build_mode need to be replaced with the new .name property. Mixing use of both in the same Jenkinsfile will cause undesired behavior. --- vars/utils.groovy | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/vars/utils.groovy b/vars/utils.groovy index 536c5b6..888e467 100644 --- a/vars/utils.groovy +++ b/vars/utils.groovy @@ -41,14 +41,23 @@ def scm_checkout(skip_disable=false) { def run(configs, concurrent = true) { def tasks = [:] for (config in configs) { - - def myconfig = new BuildConfig() // MUST be inside for loop. + + def BuildConfig myconfig = new BuildConfig() // MUST be inside for loop. myconfig = SerializationUtils.clone(config) + + def config_name = "" + config_name = config.name + // For staged deprecation of '.build_mode' in favor of '.name'. + // TODO: Remove once all Jenkinsfiles are converted. + if (myconfig.build_mode != "") { + config_name = myconfig.build_mode + } + println("config_name: ${config_name}") // Code defined within 'tasks' is eventually executed on a separate node. // 'tasks' is a java.util.LinkedHashMap, which preserves insertion order. - tasks["${config.nodetype}/${config.build_mode}"] = { - node(config.nodetype) { + tasks["${myconfig.nodetype}/${config_name}"] = { + node(myconfig.nodetype) { def runtime = [] // If conda packages were specified, create an environment containing // them and then 'activate' it. @@ -121,7 +130,7 @@ def run(configs, concurrent = true) { runtime.add(var) } withEnv(runtime) { - stage("Build (${myconfig.build_mode})") { + stage("Build (${myconfig.name})") { unstash "source_tree" for (cmd in myconfig.build_cmds) { sh(script: cmd) @@ -129,7 +138,7 @@ def run(configs, concurrent = true) { } if (myconfig.test_cmds.size() > 0) { try { - stage("Test (${myconfig.build_mode})") { + stage("Test (${myconfig.name})") { for (cmd in myconfig.test_cmds) { sh(script: cmd) } -- cgit