From f0e33f02076450df1da703c035bceddbf50d7490 Mon Sep 17 00:00:00 2001 From: Matt Rendina Date: Mon, 4 Dec 2017 12:53:16 -0500 Subject: Use new method and clean up --- vars/utils.groovy | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'vars/utils.groovy') diff --git a/vars/utils.groovy b/vars/utils.groovy index 4ea93a7..1dc7063 100644 --- a/vars/utils.groovy +++ b/vars/utils.groovy @@ -40,32 +40,22 @@ def concurrent(configs) { tasks["${config.nodetype}/${config.build_mode}"] = { node(config.nodetype) { // FIXME: Generalize env vars. - //for (var in myconfig.env_vars) { - // if (var.contains("PATH")) { - // tvar = var.replace("PATH=.", env.WORKSPACE) - // env.PATH = "${tvar}:${env.PATH}" - // } - //} - - // More sophisticated approach. + // Expand environment variable specifications by using the shell + // to dereference any var references and then render the entire + // value as a canonical path. for (var in myconfig.env_vars) { def varName = var.tokenize("=")[0] - println("var name = ${varName}") def varValue= var.tokenize("=")[1] - println("var value = ${varValue}") // examine var value, if it contains var refs, expand them. def expansion = "" if (varValue.contains("\$")) { - println("dollar sign") expansion = sh(script: "echo ${varValue}", returnStdout: true) println("EXPANSION = ${expansion}") } // Convert var value to canonical based on a WORKSPACE base directory. - absVarValue = new File(env.WORKSPACE, expansion).getCanonicalPath() - println("ABS VAR VALUE = ${absVarValue}") + canonicalVarValue = new File(env.WORKSPACE, expansion).getCanonicalPath() + println("canonicalVarValue= ${canonicalVarValue}") } - - stage("Build (${myconfig.build_mode})") { unstash "source_tree" for (cmd in myconfig.build_cmds) { -- cgit