summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile9
-rw-r--r--scripts/Dockerfile8
-rw-r--r--scripts/Test.Dockerfile6
-rwxr-xr-xscripts/run_test.sh12
4 files changed, 26 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 28226a7..2b2e93c 100644
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,8 @@
export WS_ROOT=$(CURDIR)
export BR=$(WS_ROOT)/build-root
PLATFORM?=sweetcomb
+export VPP_VERSION?=release
+export REBUILD_DOCKER_IMAGE?=no
##############
#OS Detection#
@@ -103,8 +105,11 @@ help:
@echo " build-plugins - build plugins"
@echo " build-gnmi - build gNMIServer"
@echo " build-package - build rpm or deb package"
- @echo " docker - build sweetcomb in docker enviroment"
- @echo " docker-test - run test in docker enviroment"
+ @echo " docker - build sweetcomb in docker enviroment, with optional arguments :"
+ @echo " VPP_VERSION=release [master|release] specifies VPP version to be used"
+ @echo " REBUILD_DOCKER_IMAGE=no [yes|no] force rebuild docker image"
+ @echo " docker-test - run test in docker enviroment, with optional argument :"
+ @echo " REBUILD_DOCKER_IMAGE=no [yes|no] force rebuild docker image"
@echo " clean - clean all build"
@echo " distclean - remove all build directory"
@echo " checkstyle - check coding style"
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index b07382c..61085b5 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -1,5 +1,7 @@
FROM ubuntu:18.04
+ARG vpp_version=release
+
# Layer0: Prepare sweetcomb environement by installing sysrepo, netopeer2 & vpp
# Layer1: Install vpp
# Layer2: Install sweetcomb
@@ -16,13 +18,9 @@ RUN rm -rf /opt/dev/*
RUN apt-get install -y \
sudo curl \
inetutils-ping \
- && curl -s https://packagecloud.io/install/repositories/fdio/1904/script.deb.sh | sudo bash \
+ && curl -s https://packagecloud.io/install/repositories/fdio/$vpp_version/script.deb.sh | sudo bash \
&& apt-get -y --force-yes install vpp libvppinfra* vpp-plugin-* vpp-dev
-RUN apt-get update; \
- apt-get install -y clang-format python3-pip; \
- pip3 install pexpect pyroute2 psutil;
-
#Layer2
COPY . /root/src/sweetcomb
WORKDIR /root/src/sweetcomb
diff --git a/scripts/Test.Dockerfile b/scripts/Test.Dockerfile
new file mode 100644
index 0000000..df2e0b2
--- /dev/null
+++ b/scripts/Test.Dockerfile
@@ -0,0 +1,6 @@
+FROM sweetcomb_img:latest
+
+#Install utils for testing
+RUN apt-get update; \
+ apt-get install -y vim clang-format python3-pip; \
+ pip3 install pexpect pyroute2 psutil; \ No newline at end of file
diff --git a/scripts/run_test.sh b/scripts/run_test.sh
index ca6c6b6..5586c7e 100755
--- a/scripts/run_test.sh
+++ b/scripts/run_test.sh
@@ -15,6 +15,7 @@
# limitations under the License.
IMAGE="sweetcomb_img"
+IMAGE_TEST="sweetcomb_test_img"
CONTAINER="sweetcomb_test"
FIND=`docker container ls -a | grep ${CONTAINER}`
@@ -25,12 +26,19 @@ if [ -n "${FIND}" ]; then
fi
FIND=`docker images | grep ${IMAGE}`
-if [ -z "${FIND}" ]; then
+if [ -z "${FIND}" ] || [ "$REBUILD_DOCKER_IMAGE" == "yes" ]; then
./scripts/docker.sh
fi
+FIND=`docker images | grep ${IMAGE_TEST}`
+if [ -z "${FIND}" ] || [ "$REBUILD_DOCKER_IMAGE" == "yes" ]; then
+ echo "Rebuild test image"
+ docker rmi ${IMAGE_TEST} -f > /dev/null 2>&1
+ docker build -t ${IMAGE_TEST} -f ./scripts/Test.Dockerfile .
+fi
+
echo "Start container"
-docker run -id --privileged --name ${CONTAINER} ${IMAGE}
+docker run -id --privileged --name ${CONTAINER} ${IMAGE_TEST}
docker cp . ${CONTAINER}:/root/src/sweetcomb
docker exec -it ${CONTAINER} bash -c "
cd /root/src/sweetcomb &&