Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profusion-mobi.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=T751RiA0nCu0gJIJaUCQG7IpY5/fzfxZ1bAJaHrBQVA=; b=jKIfhX5udZ9+gyIM7TwRlj7yYkAUnLZsktt3OB5dFMJTIim8sqSWOdd8X6QzxZMjIr BS2N5/gorhjSqJo3KVqhhYdWSpQeG+7Rz6SQMSHvCkQFdekhwlzpJZPE77JV0cabWubP 7/4FIOc2bC/jMFiHwqeyZrdQPxbK4ETE1PaIgc008+VLfj7c48Np/rTPhW7P6AWgVCX1 oaqlo9Ie5G7RaK9a4CgZCPJWXaC7nigjrzPBDaxHJJ7BRsgJvVTutBZP8ZZJmmUky98j tit/LW09DBGUVxVPw1pOP8KW+nECoK6/JxFrbgsg5BgyS9frHLcu0/XWUgZYfEpX37lD +0ww== From: Guilherme Campos Camargo Date: Fri, 16 Feb 2018 19:45:57 -0200 Message-Id: <20180216214557.27540-1-guicc@profusion.mobi> Subject: [Fuego] [PATCH] Move fuego-ro/core to image during build and keep core as submodule List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org Hello, everyone Those directories ideally shoud be copied to the image during build time given that Fuego would not run if their content is not available. By doing this, we're also making sure that a user that plans to use fuego-base docker image directly (or as a base image for his own docker images) will be able to do it straightforwardly, without the need of cloning other repositories or bind-mounting host's directories. It's also a good idea to keep fuego-core locked in a fixed release, what we can enforce easily by using git submodules. This is desired if we want to use a stable version of fuego to test new versions of fuego. On this patch we configure fuego-core as a submodule and make the changes needed for copying the required contents of the mentioned directories. -- Tim, please let us know what you think about it. Thanks Signed-off-by: Guilherme Campos Camargo --- .dockerignore | 2 -- .gitmodules | 3 +++ Dockerfile | 7 +++++++ fuego-core | 1 + fuego-host-scripts/docker-build-image.sh | 14 ++++++++++++++ fuego-host-scripts/docker-create-container.sh | 7 ------- 6 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 .gitmodules create mode 160000 fuego-core diff --git a/.dockerignore b/.dockerignore index d73e89c..6af69cd 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,2 @@ -fuego-rw -fuego-ro fuego-host-scripts .git diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d1adb2a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "fuego-core"] + path = fuego-core + url = https://bitbucket.org/tbird20d/fuego-core.git diff --git a/Dockerfile b/Dockerfile index cc79351..fc394ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -106,6 +106,13 @@ RUN curl -L -O ${JENKINS_URL} && \ dpkg -i jenkins_${JENKINS_VERSION}_all.deb && \ rm jenkins_${JENKINS_VERSION}_all.deb +# ============================================================================== +# Install fuego-core and fuego-ro +# ============================================================================== +COPY fuego-ro /fuego-ro +COPY fuego-rw /fuego-rw +COPY fuego-core /fuego-core + # ============================================================================== # Post installation # ============================================================================== diff --git a/fuego-core b/fuego-core new file mode 160000 index 0000000..5bf5f81 --- /dev/null +++ b/fuego-core @@ -0,0 +1 @@ +Subproject commit 5bf5f81baba3ae107d4316a628825e38f1f98094 diff --git a/fuego-host-scripts/docker-build-image.sh b/fuego-host-scripts/docker-build-image.sh index d276ee0..b345f0a 100755 --- a/fuego-host-scripts/docker-build-image.sh +++ b/fuego-host-scripts/docker-build-image.sh @@ -1,5 +1,19 @@ #!/bin/bash # $1 - name for the docker image (default: fuego) + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +echo "${DIR}"/../fuego-core/.git +if [ ! -e "${DIR}"/../fuego-core/.git ]; then + git submodule update --init +fi + DOCKERIMAGE=${1:-fuego} sudo docker build -t ${DOCKERIMAGE} \ diff --git a/fuego-host-scripts/docker-create-container.sh b/fuego-host-scripts/docker-create-container.sh index 3d133bd..53a7a7a 100755 --- a/fuego-host-scripts/docker-create-container.sh +++ b/fuego-host-scripts/docker-create-container.sh @@ -12,11 +12,6 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DOCKERIMAGE=${1:-fuego} DOCKERCONTAINER=${2:-fuego-container} -if [ ! -d $DIR/../../fuego-core ]; then - echo "You need to clone fuego-core at $DIR/../../fuego-core" - exit 1 -fi - if [ "${UID}" == "0" ]; then uid=$(id -u "${SUDO_USER}") gid=$(id -g "${SUDO_USER}") @@ -31,8 +26,6 @@ sed -i "s/docker_jenkins_gid=500/docker_jenkins_gid=$gid/" $DIR/../fuego-ro/conf sudo docker create -it --name ${DOCKERCONTAINER} \ -v /boot:/boot:ro \ -v $DIR/../fuego-rw:/fuego-rw \ - -v $DIR/../fuego-ro:/fuego-ro:ro \ - -v $DIR/../../fuego-core:/fuego-core:ro \ -e http_proxy=${http_proxy} \ -e https_proxy=${https_proxy:-$http_proxy} \ --net="host" ${DOCKERIMAGE} || \ -- 2.16.1