Skip to contentSkip to conversation

Move fuego-ro/core to image during build and keep core as submodule

PATCH In review Guilherme Campos Camargo 2 participants 3 messages Feb 16, 2018 – Feb 20, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Move fuego-ro/core to image during build and keep core as submodule

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

---
 .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
.dockerignore +0 -2
index d73e89c..6af69cd 100644
@@ -1,4 +1,2 @@
-fuego-rw
-fuego-ro
 fuego-host-scripts
 .git
.gitmodules new file +3 -0
new file mode 100644
index 0000000..d1adb2a
@@ -0,0 +1,3 @@
+[submodule "fuego-core"]
+	path = fuego-core
+	url = https://bitbucket.org/tbird20d/fuego-core.git
Dockerfile +7 -0
index cc79351..fc394ad 100644
@@ -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
 # ==============================================================================
fuego-core new file +1 -0
new file mode 160000
index 0000000..5bf5f81
@@ -0,0 +1 @@
+Subproject commit 5bf5f81baba3ae107d4316a628825e38f1f98094
fuego-host-scripts/docker-build-image.sh +14 -0
index d276ee0..b345f0a 100755
@@ -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} \
fuego-host-scripts/docker-create-container.sh +0 -7
index 3d133bd..53a7a7a 100755
@@ -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} || \
Signature · 1 line
2.16.1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Guilherme Campos Camargo
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.

Quoted 7 lines

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.

I understand virtually none of what you wrote here.

Is this patch for tbird20d/fuego? Is it against profusionmobil/fuego-release-test?

I haven't figured out how the fuego-release-test works yet, so I don't understand what you're referring to when you say "those directories", or "fuego-base docker image".

Quoted 3 lines

--
Tim, please let us know what you think about it.

I need to understand what's going on, and how all these repositories interact, before I can give any coherent answer.

I think that once I've run the release test successfully, I will be able to figure out what you're talking about here.
-- Tim

#2 lore raw
Quoted 15 lines · On Mon, Feb 19, 2018 at 10:18 PM, <[email protected]> wrote:
Quoted 15 lines

-----Original Message-----
From: Guilherme Campos Camargo
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.

Quoted 9 lines
Quoted 3 lines

On this patch we configure fuego-core as a submodule and make the changes needed for copying the required contents of the mentioned directories.

I understand virtually none of what you wrote here.

Is this patch for tbird20d/fuego? Is it against
profusionmobil/fuego-release-test?

​This patch is for tbird20d/fuego.​

Quoted 5 lines

I haven't figured out how the fuego-release-test works yet, so I don't understand what you're referring to when you say "those directories", or "fuego-base docker image".

​Sorry about that.

On profusionmobi/fuego-release-test Dockerfile, I'm using a stable fuego image as base, with the following directive:

FROM fuegotest/fuego-base:latest

fuegotest/fuego-base image has been created from tbird20d/fuego:next - with the patch of this e-mail applied - and uploaded to
https://hub.docker.com/r/fuegotest/fuego-base/

For fuego-release-test to work as presented (in my other e-mail), we need to have fuego-core and fuego-base as part of the base image (fuegotest/fuego-base).
This patch just copies fuego-base and fuego-core to the fuego image during build time. Since fuego-core is in a separate repository, I'm just moving it it inside
fuego as a submodule.

​

Quoted 13 lines
Quoted 4 lines

--
Tim, please let us know what you think about it.

I need to understand what's going on, and how all these repositories interact, before I can give any coherent answer.

I think that once I've run the release test successfully, I will be able to figure out what you're talking about here.
-- Tim