aboutsummaryrefslogtreecommitdiff
path: root/vars
diff options
context:
space:
mode:
authorMatt Rendina <mrendina@stsci.edu>2018-09-07 15:26:36 -0400
committerMatt Rendina <rendinam@users.noreply.github.com>2018-09-11 16:31:59 -0400
commitcb55786d672b131f0c56cf127246e8afe481e799 (patch)
treeea59f4dfbda31dbf75258a8c41a11b98dfa78b98 /vars
parentda5182bc4e7ecf1ac7b520bace3915013741ab38 (diff)
downloadjscu_refactor-cb55786d672b131f0c56cf127246e8afe481e799.tar.gz
Test for and disallow problematic interpolated strings in env_vars list.1.2.3
Clean up comments a bit.
Diffstat (limited to 'vars')
-rw-r--r--vars/utils.groovy25
1 files changed, 21 insertions, 4 deletions
diff --git a/vars/utils.groovy b/vars/utils.groovy
index 444d8a6..b4b245d 100644
--- a/vars/utils.groovy
+++ b/vars/utils.groovy
@@ -116,6 +116,7 @@ def install_conda(version, install_dir) {
// configurations in parallel. The default is
// true when no value is provided.
def run(configs, concurrent = true) {
+
def tasks = [:]
configs.eachWithIndex { config, index ->
def BuildConfig myconfig = new BuildConfig() // MUST be inside for loop.
@@ -125,10 +126,26 @@ def run(configs, concurrent = true) {
println("config_name: ${config_name}")
- // For containerized CI builds, code defined within 'tasks' is eventually executed
- // on a separate node.
- // CAUTION: For builds elsewhere (e.g. nightly regression tests), any parallel
- // configs will be executed simultaneously WITHIN THE SAME WORKSPACE.
+ // Test for GStrings (double quoted). These perform string interpolation
+ // immediately and are very likely not what the user intends to do when
+ // defnining environment variables to use in the build. Disallow them here.
+ config.env_vars.each { evar ->
+ println(evar)
+ if (evar.getClass() == org.codehaus.groovy.runtime.GStringImpl) {
+ msg = "Immediate interpolation of variables in the 'env_vars'" +
+ " list is not supported and will probably not do what" +
+ " you expect. Please change the double quotes (\") to " +
+ "single quotes (') in each value of the 'env_vars' list."
+ println(msg)
+ error('Abort the build.')
+ }
+ }
+
+ // For containerized CI builds, code defined within 'tasks' is
+ // eventually executed on a separate node.
+ // CAUTION: For builds elsewhere (e.g. nightly regression tests),
+ // any parallel configs will be executed simultaneously
+ // WITHIN THE SAME WORKSPACE.
// 'tasks' is a java.util.LinkedHashMap, which preserves insertion order.
tasks["${myconfig.nodetype}/${config_name}"] = {
node(myconfig.nodetype) {