diff options
author | Christophe Lyon <christophe.lyon@linaro.org> | 2017-02-06 20:52:19 +0000 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2017-02-17 11:51:16 +0000 |
commit | c6b13dcff529dac6b2c9559c2298ea60159002ae (patch) | |
tree | 2095d317e0e103279ffc9fd0f6deb1daa301fac5 | |
parent | 963967d82b6c46109a4892744c3194a989431aba (diff) |
jenkins.sh: Do not set WORKSPACE to a default value ($pwd).
WORKSPACE used to be set to $(pwd) if not already defined,
but if jenkins.sh is called remotely via ssh for instance,
WORKSPACE is undefined but the build succeeds in $HOME
instead, which is misleading and can confuse other Jenkins
script.
This patch removes this default value and prints an error
message in case $user_workspace (derived from $WORKSPACE,
or defined by a command-line option) is undefined.
Change-Id: I53a927a8f5e00430e2aefa22991daa42b2776b95
-rwxr-xr-x | jenkins.sh | 22 |
1 files changed, 9 insertions, 13 deletions
@@ -24,9 +24,8 @@ PS4='+ $PRGNAME: ${FUNCNAME+"$FUNCNAME : "}$LINENO: ' usage() { - # Format this section with 75 columns. cat << EOF - jenkins.sh [--help] [-s snapshot dir] [g git reference dir] [--abedir path] [w workspace] + jenkins.sh [--help] [-s snapshot dir] [g git reference dir] [--abedir path] [-w workspace] EOF return 0 } @@ -41,9 +40,6 @@ fi abe_dir= # This is where all the builds go -if test x"${WORKSPACE}" = x; then - WORKSPACE="$(pwd)" -fi user_workspace="${WORKSPACE}" # The files in this directory are shared across all platforms @@ -55,9 +51,6 @@ git_reference="${HOME}/snapshots-ref" # Override default versions of components change="" -# set default values for options to make life easier -user_snapshots="${user_workspace}/snapshots" - # Server to store results on. logserver="" @@ -130,6 +123,14 @@ if test x"${abe_dir}" = x; then usage fi +if test x"${user_workspace}" = x; then + echo "Error: user_workspace is not defined. Make sure WORKSPACE is defined or use --workspace option" + usage +fi + +# set default values for options to make life easier +user_snapshots="${user_workspace}/snapshots" + # Non matrix builds use node_selector, but matrix builds use NODE_NAME if test x"${node_selector}" != x; then node="$(echo ${node_selector} | tr '-' '_')" @@ -273,11 +274,6 @@ if test x"${libc}" != x; then esac fi -# This is the top level directory where builds go. -if test x"${user_workspace}" = x; then - user_workspace="${WORKSPACE}" -fi - # Create a build directory if test -d ${user_workspace}/_build; then rm -fr ${user_workspace}/_build |