aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Rendina <rendinam@users.noreply.github.com>2019-06-26 15:41:02 -0400
committerGitHub <noreply@github.com>2019-06-26 15:41:02 -0400
commit0576b7bcd04327acb3d082a71f7aaf5fef484488 (patch)
tree6e9047332b09a2df4ce6b74274338bd1ba0d17ac
parent7f123b810c6b49498b14e01029d06e8b5e6ac839 (diff)
downloadjscu_refactor-0576b7bcd04327acb3d082a71f7aaf5fef484488.tar.gz
Override value of HOME to be the job's workspace root dir. (#56)1.3.19
* Set HOME to be workspace root before setting other env vars. * Expand self-testing Jenkinsfile to include HOME override checking.
-rw-r--r--Jenkinsfile13
-rw-r--r--vars/utils.groovy4
2 files changed, 13 insertions, 4 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index 25758ae..0ebbf0f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,4 +1,4 @@
-//@Library('utils@ymlfix') _
+//@Library('utils@homedir') _
// [skip ci] and [ci skip] have no effect here.
if (utils.scm_checkout(['skip_disable':true])) return
@@ -35,7 +35,10 @@ bc0.env_vars = ['VAR_ONE=1',
bc0.conda_ver = '4.6.4'
bc0.conda_packages = ['python=3.6',
'pytest']
-bc0.build_cmds = ["date",
+bc0.build_cmds = ["env",
+ "ls -al ..", // Workspace root.
+ "ls -al", // Project clone dir.
+ "conda config --show",
"./access_env_var.sh",
"which python",
"conda install ipython"]
@@ -53,8 +56,10 @@ bc1.test_cmds[1] = "${PYTEST} tests/test_25pass.py"
bc2 = utils.copy(bc0)
bc2.name = 'Third build config'
bc2.conda_packages = ['python=3.6']
-bc2.build_cmds = ["which python"]
-bc2.test_cmds = ["ls -al"]
+bc2.build_cmds = ["env",
+ "which python"]
+bc2.test_cmds = ["ls -al ..", // Workspace root.
+ "ls -al"] // Project clone dir.
bc2.test_configs = []
diff --git a/vars/utils.groovy b/vars/utils.groovy
index 57c9ef6..b7e2d3e 100644
--- a/vars/utils.groovy
+++ b/vars/utils.groovy
@@ -622,6 +622,10 @@ def expandEnvVars(config) {
// Expand environment variable specifications by using the shell
// to dereference any var references and then render the entire
// value as a canonical path.
+
+ // Override the HOME dir to be the job workspace.
+ config.env_vars.add("HOME=${env.WORKSPACE}")
+
for (var in config.env_vars) {
// Process each var in an environment defined by all the prior vars.
withEnv(config.runtime) {