ci: Fix environment variable check
The check for the variables were passing even tho they were not set,
resulting in bad syntax in the docker file:
ENV DL_DIR
ENV CCACHE_DIR '
+ docker build --network=host -t openpower/op-build-ubuntu1604 -
Sending build context to Docker daemon 2.56kB
Error response from daemon: ENV must have two arguments
I am no bash guru; this test is what is recommended by the first hit on
stackoverflow. Improve it if you know better.
Signed-off-by: Joel Stanley <joel@jms.id.au>
diff --git a/ci/build.sh b/ci/build.sh
index f663ef4..44852c6 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -105,10 +105,10 @@
PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
fi
fi
- if [[ -n "DL_DIR" ]]; then
+ if [ ! -z ${DL_DIR+x} ]; then
DL_DIR_ENV="ENV DL_DIR $DL_DIR"
fi
- if [[ -n "CCACHE_DIR" ]]; then
+ if [ ! -z ${CCACHE_DIR+x} ]; then
CCACHE_DIR_ENV="ENV CCACHE_DIR $CCACHE_DIR"
fi