aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephane Desneux <stephane.desneux@iot.bzh>2017-03-27 14:32:48 +0200
committerStephane Desneux <stephane.desneux@iot.bzh>2017-03-27 14:49:04 +0200
commit7a305b6779b7cbf7ddf22dbaaf2c168b4c4697aa (patch)
tree3faa8ac6c8c863a872c8ad55c7de9b7c6a396478
parent00bd644c0fbaf489fe32863d9fea3f3977975624 (diff)
disable interactive mode in usual target 'build'
In Jenkins, the build job will now fail without breaking and waiting for user interaction. This patch also adds a new target 'build-debug' where debug is active. So to summarize: * 'make build-debug' does as before (interactive mode on error) * 'make build' won't go interactive anymore and will simply fail (used by jenkins) Change-Id: I951cecb58d03b48e4779086a9fba9b5a88889fca Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
-rw-r--r--.gitignore1
-rwxr-xr-xINSTALL/setup_image.sh8
-rw-r--r--Makefile20
3 files changed, 24 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 726c3ca..701b867 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
.*.sw*
+INSTALL/DEBUG
diff --git a/INSTALL/setup_image.sh b/INSTALL/setup_image.sh
index 00a0a50..b7df59d 100755
--- a/INSTALL/setup_image.sh
+++ b/INSTALL/setup_image.sh
@@ -18,12 +18,16 @@ function debug() {
set -x
return 0 # continue
}
-trap debug ERR # on error, run a sleep tp debug container
-
# get the INSTALL dir (the one where we were launched)
INSTDIR=$(cd $(dirname $0) && pwd -P)
echo "Detected container install dir = $INSTDIR"
+if [[ -f $INSTDIR/DEBUG ]]; then
+ echo "#### DEBUG MODE IS ACTIVE ####"
+ trap debug ERR # on error, run a sleep tp debug container
+fi
+
+
################################## variables #################################
# source variables in conf file
diff --git a/Makefile b/Makefile
index f08ca2d..9f19a55 100644
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,7 @@ help:
@echo "- clean: drop existing container and image"
@echo "- distclean: drop temp images (the one produced by a bad Dockerfile...)"
@echo "- build: create new image"
+ @echo "- build-debug: create new image (debug mode = break and wait at first error)"
@echo "- test: start a new test container and enter in it. After exit, the container is destoyed"
@echo "- push: push the image to registry $(REGISTRY)"
@echo "- push-latest: push the image to registry $(REGISTRY) and also tag as 'latest'"
@@ -55,6 +56,7 @@ clean:
echo "Removing image $(IMAGE_LATEST)"; \
docker rmi $(IMAGE_LATEST) ; \
} || true
+ @rm -f INSTALL/DEBUG
# remove spurious containers and images left by broken builds
.PHONY:distclean
@@ -64,11 +66,23 @@ distclean: clean
docker rmi $$imgid; \
done
+.PHONY:build-debug
+build-debug:
+ @echo "------------------- Building image $(NAME) (debug mode) -------------------"
+ @touch INSTALL/DEBUG
+ @docker build --no-cache=true --rm --pull -t $(IMAGE_NAME) .
+ @rm -f INSTALL/DEBUG
+ @docker images
+
+# inside jenkins, we don't want the build script to break and wait for interaction
+# after first error. So we remove the file inside INSTALL dir which indicates to the
+# setup script to enable DEBUG.
.PHONY:build
build:
- @echo "------------------- Building image $(NAME) -------------------"; \
- docker build --no-cache=true --rm --pull -t $(IMAGE_NAME) .
- docker images
+ @echo "------------------- Building image $(NAME) -------------------"
+ @rm -f INSTALL/DEBUG
+ @docker build --no-cache=true --rm --pull -t $(IMAGE_NAME) .
+ @docker images
.PHONY:test
test: