[Fuego] [PATCH 1/5] docker: add --no-cache as a parameter to the scripts
Daniel Sangorrin
daniel.sangorrin at toshiba.co.jp
Mon Feb 25 10:09:35 UTC 2019
Easier than having to comment out the definition
Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
fuego-host-scripts/docker-build-image.sh | 11 ++++++-----
install.sh | 12 +++++++++---
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/fuego-host-scripts/docker-build-image.sh b/fuego-host-scripts/docker-build-image.sh
index 6b1834a..b6fd3d0 100755
--- a/fuego-host-scripts/docker-build-image.sh
+++ b/fuego-host-scripts/docker-build-image.sh
@@ -4,16 +4,17 @@
# $3 - Dockerfile or Dockerfile.nojenkins
#
# Example:
-# ./fuego-host-scripts/docker-build-image.sh myfuegoimg 8082 Dockerfile.nojenkins
+# ./fuego-host-scripts/docker-build-image.sh --no-cache myfuegoimg 8082 Dockerfile.nojenkins
#
+if [ "$1" = "--no-cache" ]; then
+ NO_CACHE=--no-cache
+ shift
+fi
+
DOCKERIMAGE=${1:-fuego}
JENKINS_PORT=${2:-8080}
DOCKERFILE=${3:-Dockerfile}
-# uncomment this to avoid using the docker cache while building
-# (for testing)
-#NO_CACHE=--no-cache
-
if [ "$(id -u)" == "0" ]; then
JENKINS_UID=$(id -u $SUDO_USER)
JENKINS_GID=$(id -g $SUDO_USER)
diff --git a/install.sh b/install.sh
index 8385ee4..02b3fff 100755
--- a/install.sh
+++ b/install.sh
@@ -1,12 +1,12 @@
#!/bin/bash
#
-# install.sh [--help] [--priv] [<image_name>] [<port>]
+# install.sh [--help] [--priv] [--no-cache] [<image_name>] [<port>]
#
if [ -n "$1" ]; then
if [ "$1" = "--help" -o "$1" = "-h" ]; then
cat <<HERE
-Usage: install.sh [--help] [--priv] [<image_name>] [<port>]
+Usage: install.sh [--help] [--priv] [--no-cache] [<image_name>] [<port>]
Create the docker image and container with the Fuego test distribution.
If no <image_name> is provided, the image will be named 'fuego'.
@@ -19,6 +19,7 @@ options:
and USB devices. This may be needed if you have tests or
test infrastructure that requires access to serial and usb
devices.
+ --no-cache Don't use cache when creating the docker image
HERE
exit 0
fi
@@ -30,6 +31,11 @@ if [ "$1" = "--priv" ]; then
shift
fi
+if [ "$1" = "--no-cache" ]; then
+ NOCACHE=--no-cache
+ shift
+fi
+
# get fuego-core repository, if not already present
if [ ! -f fuego-core/scripts/ftc ] ; then
# set fuego-core branch to same as current fuego branch
@@ -50,7 +56,7 @@ container_name="${image_name}-container"
set -e
-source fuego-host-scripts/docker-build-image.sh ${image_name} ${jenkins_port}
+source fuego-host-scripts/docker-build-image.sh $NOCACHE ${image_name} ${jenkins_port}
if [ "$priv" == "0" ]; then
fuego-host-scripts/docker-create-container.sh ${image_name} ${container_name}
else
--
2.7.4
More information about the Fuego
mailing list