Skip to contentSkip to conversation

Docker cross-compile targets and user build support

PATCH Superseded Alex Bennée 3 participants 16 messages Feb 14, 2017 – Feb 15, 2017

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover Docker cross-compile targets and user build support

Hi Fam,

Here is the latest iteration of the docker changes without the random guff from the last posting. I've re-arranged the docker images so now the cross-builds targets are explicitly built from the Debian base. This means a standard cross build can be triggered as normal with:

   make docker-test-build@debian-armhf-cross J=9 \
     EXTRA_CONFIGURE_OPTS="--cross-prefix=arm-linux-gnueabihf-" \
     TARGET_LIST="arm-softmmu,arm-linux-user"

I've included the shippable.yml which exercises the cross build docker recipes and runs a limited build with them. I'm happy to include this in my next Travis related pull once the underlying Docker bits are merged.

Regards,

Alex.

Alex Bennée (3):
tests/docker: add basic user mapping support
new: debian docker targets for cross-compiling
.shippable.yml: new CI provider

 .shippable.yml                                     | 23 ++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 tests/docker/Makefile.include                      |  6 ++++++
 tests/docker/docker.py                             | 15 +++++++++++--
 tests/docker/dockerfiles/debian-arm64-cross.docker | 12 +++++++++++
 tests/docker/dockerfiles/debian-armhf-cross.docker | 12 +++++++++++
 tests/docker/dockerfiles/debian.docker             | 25 ++++++++++++++++++++++
 7 files changed, 92 insertions(+), 2 deletions(-)
 create mode 100644 .shippable.yml
 create mode 100644 tests/docker/dockerfiles/debian-arm64-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-armhf-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian.docker
Signature · 1 line
2.11.0
#1 lore raw

PATCH v3 1/3 tests/docker: add basic user mapping support

Currently all docker builds are done by exporting a tarball to the docker container and running the build as the containers root user. Other use cases are possible however and it is possible to map a part of users file-system to the container. This is useful for example for doing cross-builds of arbitrary source trees. For this to work smoothly the container needs to have a user created that maps cleanly to the host system.

This adds a -u option to the docker script so that:

  DEB_ARCH=armhf DEB_TYPE=stable ./tests/docker/docker.py build \
    -u --include-executable=arm-linux-user/qemu-arm \
    debian:armhf ./tests/docker/dockerfiles/debian-bootstrap.docker

Will build a container that can then be run like:

  docker run --rm -it -v /home/alex/lsrc/qemu/risu.git/:/src \
    --user=alex:alex -w /src/ debian:armhf \
    sh -c "make clean && ./configure -s && make"

Alternatively specifying USER will add the appropriate stanza when building via the Makefile:

make docker-image-debian-armhf-cross USER=1

---
v2
- write the useradd directly
- change long option to --add-current-user
v3
- images -> image's
- add r-b
- add USER to Makefile

---
 tests/docker/Makefile.include |  2 ++
 tests/docker/docker.py        | 15 +++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
tests/docker/Makefile.include +2 -0
index 3f15d5aea8..8db55e43aa 100644
@@ -50,6 +50,7 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker
 	$(call quiet-command,\
 		$(SRC_PATH)/tests/docker/docker.py build qemu:$* $< \
 		$(if $V,,--quiet) $(if $(NOCACHE),--no-cache) \
+		$(if $(USER),--add-current-user,) \
 		$(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)),\
 		"BUILD","$*")
 
@@ -99,6 +100,7 @@ docker:
 	@echo '                         (default is 1)'
 	@echo '    DEBUG=1              Stop and drop to shell in the created container'
 	@echo '                         before running the command.'
+	@echo '    USER=1		Add current user to docker image.'
 	@echo '    NOCACHE=1            Ignore cache when build images.'
 	@echo '    EXECUTABLE=<path>    Include executable in image.'
 
tests/docker/docker.py +13 -2
index 37d83199e7..3e6e7c6460 100755
@@ -25,6 +25,7 @@ import signal
 from tarfile import TarFile, TarInfo
 from StringIO import StringIO
 from shutil import copy, rmtree
+from pwd import getpwuid
 
 
 DEVNULL = open(os.devnull, 'wb')
@@ -149,13 +150,20 @@ class Docker(object):
         labels = json.loads(resp)[0]["Config"].get("Labels", {})
         return labels.get("com.qemu.dockerfile-checksum", "")
 
-    def build_image(self, tag, docker_dir, dockerfile, quiet=True, argv=None):
+    def build_image(self, tag, docker_dir, dockerfile,
+                    quiet=True, user=False, argv=None):
         if argv == None:
             argv = []
 
         tmp_df = tempfile.NamedTemporaryFile(dir=docker_dir, suffix=".docker")
         tmp_df.write(dockerfile)
 
+        if user:
+            uid = os.getuid()
+            uname = getpwuid(uid).pw_name
+            tmp_df.write("\n")
+            tmp_df.write("RUN useradd -u %d -U %s" % (uid, uname))
+
         tmp_df.write("\n")
         tmp_df.write("LABEL com.qemu.dockerfile-checksum=%s" %
                      _text_checksum(dockerfile))
@@ -225,6 +233,9 @@ class BuildCommand(SubCommand):
                             help="""Specify a binary that will be copied to the
                             container together with all its dependent
                             libraries""")
+        parser.add_argument("--add-current-user", "-u", dest="user",
+                            action="store_true",
+                            help="Add the current user to image's passwd")
         parser.add_argument("tag",
                             help="Image Tag")
         parser.add_argument("dockerfile",
@@ -261,7 +272,7 @@ class BuildCommand(SubCommand):
                                        docker_dir)
 
             dkr.build_image(tag, docker_dir, dockerfile,
-                            quiet=args.quiet, argv=argv)
+                            quiet=args.quiet, user=args.user, argv=argv)
 
             rmtree(docker_dir)
 
Signature · 1 line
2.11.0
#2 lore raw

Re: [Qemu-devel] [PATCH v3 1/3] tests/docker: add basic user mapping support

Quoted 54 lines · Alex Bennée

Currently all docker builds are done by exporting a tarball to the docker container and running the build as the containers root user. Other use cases are possible however and it is possible to map a part of users file-system to the container. This is useful for example for doing cross-builds of arbitrary source trees. For this to work smoothly the container needs to have a user created that maps cleanly to the host system.

This adds a -u option to the docker script so that:

  DEB_ARCH=armhf DEB_TYPE=stable ./tests/docker/docker.py build \
    -u --include-executable=arm-linux-user/qemu-arm \
    debian:armhf ./tests/docker/dockerfiles/debian-bootstrap.docker

Will build a container that can then be run like:

  docker run --rm -it -v /home/alex/lsrc/qemu/risu.git/:/src \
    --user=alex:alex -w /src/ debian:armhf \
    sh -c "make clean && ./configure -s && make"

Alternatively specifying USER will add the appropriate stanza when building via the Makefile:

make docker-image-debian-armhf-cross USER=1

---
v2
- write the useradd directly
- change long option to --add-current-user
v3
- images -> image's
- add r-b
- add USER to Makefile

---
 tests/docker/Makefile.include |  2 ++
 tests/docker/docker.py        | 15 +++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
tests/docker/Makefile.include +1 -0
index 3f15d5aea8..8db55e43aa 100644
@@ -50,6 +50,7 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker
 	$(call quiet-command,\
 		$(SRC_PATH)/tests/docker/docker.py build qemu:$* $< \
 		$(if $V,,--quiet) $(if $(NOCACHE),--no-cache) \
+		$(if $(USER),--add-current-user,) \
 		$(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)),\
 		"BUILD","$*")
 

tests/docker/Makefile.include docker: · line 103

Quoted 4 lines
tests/docker/Makefile.include +1 -0
@@ -99,6 +100,7 @@ docker:
 	@echo '                         (default is 1)'
 	@echo '    DEBUG=1              Stop and drop to shell in the created container'
 	@echo '                         before running the command.'
+	@echo '    USER=1		Add current user to docker image.'

This is a bad choice of name, $USER is "$(id -un)", maybe ADD_CUR_USER?

Fam

Quoted 3 lines
tests/docker/Makefile.include +0 -0
 	@echo '    NOCACHE=1            Ignore cache when build images.'
 	@echo '    EXECUTABLE=<path>    Include executable in image.'
 
#3 lore raw

Re: [Qemu-devel] [PATCH v3 1/3] tests/docker: add basic user mapping support

Quoted 54 lines · Fam Zheng
Quoted 53 lines · Alex Bennée

Currently all docker builds are done by exporting a tarball to the docker container and running the build as the containers root user. Other use cases are possible however and it is possible to map a part of users file-system to the container. This is useful for example for doing cross-builds of arbitrary source trees. For this to work smoothly the container needs to have a user created that maps cleanly to the host system.

This adds a -u option to the docker script so that:

  DEB_ARCH=armhf DEB_TYPE=stable ./tests/docker/docker.py build \
    -u --include-executable=arm-linux-user/qemu-arm \
    debian:armhf ./tests/docker/dockerfiles/debian-bootstrap.docker

Will build a container that can then be run like:

  docker run --rm -it -v /home/alex/lsrc/qemu/risu.git/:/src \
    --user=alex:alex -w /src/ debian:armhf \
    sh -c "make clean && ./configure -s && make"

Alternatively specifying USER will add the appropriate stanza when building via the Makefile:

make docker-image-debian-armhf-cross USER=1

---
v2
- write the useradd directly
- change long option to --add-current-user
v3
- images -> image's
- add r-b
- add USER to Makefile

---
 tests/docker/Makefile.include |  2 ++
 tests/docker/docker.py        | 15 +++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
tests/docker/Makefile.include +1 -0
index 3f15d5aea8..8db55e43aa 100644
@@ -50,6 +50,7 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker
 	$(call quiet-command,\
 		$(SRC_PATH)/tests/docker/docker.py build qemu:$* $< \
 		$(if $V,,--quiet) $(if $(NOCACHE),--no-cache) \
+		$(if $(USER),--add-current-user,) \
 		$(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)),\
 		"BUILD","$*")
 
Quoted 8 lines

tests/docker/Makefile.include docker: · line 103

Quoted 5 lines
tests/docker/Makefile.include +1 -0
@@ -99,6 +100,7 @@ docker:
 	@echo '                         (default is 1)'
 	@echo '    DEBUG=1              Stop and drop to shell in the created container'
 	@echo '                         before running the command.'
+	@echo '    USER=1		Add current user to docker image.'

This is a bad choice of name, $USER is "$(id -un)", maybe ADD_CUR_USER?

Or we could just enable it by default? Is there a reason not to enable the current user for these images?

Quoted 7 lines

Fam

Quoted 3 lines
tests/docker/Makefile.include +0 -0
 	@echo '    NOCACHE=1            Ignore cache when build images.'
 	@echo '    EXECUTABLE=<path>    Include executable in image.'
 

--
Alex Bennée

#4 lore raw

Re: [Qemu-devel] [PATCH v3 1/3] tests/docker: add basic user mapping support

Quoted 66 lines · Alex Bennée
Quoted 54 lines · Fam Zheng
Quoted 53 lines · Alex Bennée

Currently all docker builds are done by exporting a tarball to the docker container and running the build as the containers root user. Other use cases are possible however and it is possible to map a part of users file-system to the container. This is useful for example for doing cross-builds of arbitrary source trees. For this to work smoothly the container needs to have a user created that maps cleanly to the host system.

This adds a -u option to the docker script so that:

  DEB_ARCH=armhf DEB_TYPE=stable ./tests/docker/docker.py build \
    -u --include-executable=arm-linux-user/qemu-arm \
    debian:armhf ./tests/docker/dockerfiles/debian-bootstrap.docker

Will build a container that can then be run like:

  docker run --rm -it -v /home/alex/lsrc/qemu/risu.git/:/src \
    --user=alex:alex -w /src/ debian:armhf \
    sh -c "make clean && ./configure -s && make"

Alternatively specifying USER will add the appropriate stanza when building via the Makefile:

make docker-image-debian-armhf-cross USER=1

---
v2
- write the useradd directly
- change long option to --add-current-user
v3
- images -> image's
- add r-b
- add USER to Makefile

---
 tests/docker/Makefile.include |  2 ++
 tests/docker/docker.py        | 15 +++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
tests/docker/Makefile.include +1 -0
index 3f15d5aea8..8db55e43aa 100644
@@ -50,6 +50,7 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker
 	$(call quiet-command,\
 		$(SRC_PATH)/tests/docker/docker.py build qemu:$* $< \
 		$(if $V,,--quiet) $(if $(NOCACHE),--no-cache) \
+		$(if $(USER),--add-current-user,) \
 		$(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)),\
 		"BUILD","$*")
 
Quoted 8 lines

tests/docker/Makefile.include docker: · line 103

Quoted 5 lines
tests/docker/Makefile.include +1 -0
@@ -99,6 +100,7 @@ docker:
 	@echo '                         (default is 1)'
 	@echo '    DEBUG=1              Stop and drop to shell in the created container'
 	@echo '                         before running the command.'
+	@echo '    USER=1		Add current user to docker image.'

This is a bad choice of name, $USER is "$(id -un)", maybe ADD_CUR_USER?

Quoted 2 lines

Or we could just enable it by default? Is there a reason not to enable the current user for these images?

I think that's fine, but then docker.py needs to tolerate user already existing in the image, such as when you build qemu:debian-cross-$foo on top of qemu:debian.

Fam

#5 lore raw

PATCH v3 2/3 new: debian docker targets for cross-compiling

In reply to Alex Bennée

This provides a basic Debian install with access to the emdebian cross compilers. The debian-armhf-cross and debian-arm64-cross targets build on the basic Debian image to allow cross compiling to those targets.

To build against the cross compiler a cross-compile prefix needs to be set in the configure options, for example:

  make docker-test-build@debian-arm64-cross \
    EXTRA_CONFIGURE_OPTS="--cross-prefix=aarch64-linux-gnu-" \
    TARGET_LIST="aarch64-softmmu,aarch64-linux-user"

---
v2
- add clang (keep shippable happy)
- rm adduser code (done direct now)
- add aptitude (useful for debugging package clashes)
v3
- split into debian, debian-armhf-cross and debian-aarch64-cross

---
 tests/docker/Makefile.include                      |  4 ++++
 tests/docker/dockerfiles/debian-arm64-cross.docker | 12 +++++++++++
 tests/docker/dockerfiles/debian-armhf-cross.docker | 12 +++++++++++
 tests/docker/dockerfiles/debian.docker             | 25 ++++++++++++++++++++++
 4 files changed, 53 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-arm64-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-armhf-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian.docker
tests/docker/Makefile.include +4 -0
index 8db55e43aa..dbd12d9042 100644
@@ -54,6 +54,10 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker
 		$(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)),\
 		"BUILD","$*")
 
+# Enforce dependancies for composite images
+docker-image-debian-armhf-cross: docker-image-debian
+docker-image-debian-arm64-cross: docker-image-debian
+
 # Expand all the pre-requistes for each docker image and test combination
 $(foreach i,$(DOCKER_IMAGES), \
 	$(foreach t,$(DOCKER_TESTS) $(DOCKER_TOOLS), \
tests/docker/dockerfiles/debian-arm64-cross.docker new file +12 -0
new file mode 100644
index 0000000000..04212629f7
@@ -0,0 +1,12 @@
+#
+# Docker arm64 cross-compiler target
+#
+# This docker target builds on the base debian image.
+#
+FROM qemu:debian
+
+# Add the foreign architecture we want and install dependacies
+RUN dpkg --add-architecture arm64
+RUN apt update
+RUN apt install -yy crossbuild-essential-arm64
+RUN apt-get build-dep -yy -a arm64 qemu
tests/docker/dockerfiles/debian-armhf-cross.docker new file +12 -0
new file mode 100644
index 0000000000..1377641e3e
@@ -0,0 +1,12 @@
+#
+# Docker armhf cross-compiler target
+#
+# This docker target builds on the base debian image.
+#
+FROM qemu:debian
+
+# Add the foreign architecture we want and install dependacies
+RUN dpkg --add-architecture armhf
+RUN apt update
+RUN apt install -yy crossbuild-essential-armhf
+RUN apt-get build-dep -yy -a armhf qemu
tests/docker/dockerfiles/debian.docker new file +25 -0
new file mode 100644
index 0000000000..52bd79938e
@@ -0,0 +1,25 @@
+#
+# Docker multiarch cross-compiler target
+#
+# This docker target is builds on Debian and Emdebian's cross compiler targets
+# to build distro with a selection of cross compilers for building test binaries.
+#
+# On its own you can't build much but the docker-foo-cross targets
+# build on top of the base debian image.
+#
+FROM debian:stable-slim
+
+# Setup some basic tools we need
+RUN apt update
+RUN apt install -yy curl aptitude
+
+# Setup Emdebian
+RUN echo "deb http://emdebian.org/tools/debian/ jessie main" >> /etc/apt/sources.list
+RUN curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add -
+
+# Duplicate deb line as deb-src
+RUN cat /etc/apt/sources.list | sed "s/deb/deb-src/" >> /etc/apt/sources.list
+
+# Install common build utilities
+RUN apt update
+RUN apt install -yy build-essential clang
Signature · 1 line
2.11.0
#6 lore raw

Re: [Qemu-devel] [PATCH v3 2/3] new: debian docker targets for cross-compiling

Quoted 10 lines · Alex Bennée

This provides a basic Debian install with access to the emdebian cross compilers. The debian-armhf-cross and debian-arm64-cross targets build on the basic Debian image to allow cross compiling to those targets.

To build against the cross compiler a cross-compile prefix needs to be set in the configure options, for example:

  make docker-test-build@debian-arm64-cross \
    EXTRA_CONFIGURE_OPTS="--cross-prefix=aarch64-linux-gnu-" \
    TARGET_LIST="aarch64-softmmu,aarch64-linux-user"

If cross-compile is the only meaningful way to use this image, we probably should bake the configure option into the dockerfile and pick it up automatically in common.rc. What do you think?

Fam

#7 lore raw

Re: [Qemu-devel] [PATCH v3 2/3] new: debian docker targets for cross-compiling

Quoted 8 lines · Fam Zheng
Quoted 7 lines · Alex Bennée

This provides a basic Debian install with access to the emdebian cross compilers. The debian-armhf-cross and debian-arm64-cross targets build on the basic Debian image to allow cross compiling to those targets.

To build against the cross compiler a cross-compile prefix needs to be set in the configure options, for example:

Quoted 7 lines
Quoted 3 lines
  make docker-test-build@debian-arm64-cross \
    EXTRA_CONFIGURE_OPTS="--cross-prefix=aarch64-linux-gnu-" \
    TARGET_LIST="aarch64-softmmu,aarch64-linux-user"

If cross-compile is the only meaningful way to use this image, we probably should bake the configure option into the dockerfile and pick it up automatically in common.rc. What do you think?

The example change is like this:

tests/docker/common.rc +1 -1
index 21657e87c6..6865689bb5 100755
@@ -29,7 +29,7 @@ build_qemu()
     config_opts="--enable-werror \
                  ${TARGET_LIST:+--target-list=${TARGET_LIST}} \
                  --prefix=$PWD/install \
-                 $EXTRA_CONFIGURE_OPTS \
+                 $QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS \
                  $@"
     echo "Configure options:"
     echo $config_opts
tests/docker/dockerfiles/debian-arm64-cross.docker +1 -0
index 04212629f7..fc1c135e74 100644
@@ -10,3 +10,4 @@ RUN dpkg --add-architecture arm64
 RUN apt update
 RUN apt install -yy crossbuild-essential-arm64
 RUN apt-get build-dep -yy -a arm64 qemu
+ENV QEMU_CONFIGURE_OPTS --cross-prefix=aarch64-linux-gnu-
#8 lore raw

Re: [Qemu-devel] [PATCH v3 2/3] new: debian docker targets for cross-compiling

Quoted 37 lines · Fam Zheng
Quoted 8 lines · Fam Zheng
Quoted 7 lines · Alex Bennée

This provides a basic Debian install with access to the emdebian cross compilers. The debian-armhf-cross and debian-arm64-cross targets build on the basic Debian image to allow cross compiling to those targets.

To build against the cross compiler a cross-compile prefix needs to be set in the configure options, for example:

Quoted 7 lines
Quoted 3 lines
  make docker-test-build@debian-arm64-cross \
    EXTRA_CONFIGURE_OPTS="--cross-prefix=aarch64-linux-gnu-" \
    TARGET_LIST="aarch64-softmmu,aarch64-linux-user"

If cross-compile is the only meaningful way to use this image, we probably should bake the configure option into the dockerfile and pick it up automatically in common.rc. What do you think?

The example change is like this:

tests/docker/common.rc +1 -1
index 21657e87c6..6865689bb5 100755
@@ -29,7 +29,7 @@ build_qemu()
     config_opts="--enable-werror \
                  ${TARGET_LIST:+--target-list=${TARGET_LIST}} \
                  --prefix=$PWD/install \
-                 $EXTRA_CONFIGURE_OPTS \
+                 $QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS \
                  $@"
     echo "Configure options:"
     echo $config_opts
tests/docker/dockerfiles/debian-arm64-cross.docker +0 -0
index 04212629f7..fc1c135e74 100644

tests/docker/dockerfiles/debian-arm64-cross.docker RUN dpkg --add-architecture arm64 · line 13

Quoted 4 lines
tests/docker/dockerfiles/debian-arm64-cross.docker +1 -0
@@ -10,3 +10,4 @@ RUN dpkg --add-architecture arm64
 RUN apt update
 RUN apt install -yy crossbuild-essential-arm64
 RUN apt-get build-dep -yy -a arm64 qemu
+ENV QEMU_CONFIGURE_OPTS --cross-prefix=aarch64-linux-gnu-

Yeah that seems like a good idea. Then a make docker-test-build@debian-armhf-cross will work as expected ;-)

--
Alex Bennée

#9 lore raw

Re: [Qemu-devel] [PATCH v3 2/3] new: debian docker targets for cross-compiling

In reply to Alex Bennée
Quoted 3 lines · Alex Bennée

This provides a basic Debian install with access to the emdebian cross compilers. The debian-armhf-cross and debian-arm64-cross targets build on the basic Debian image to allow cross compiling to those targets.

Is there a particular reason for creating different docker images for each cross target rather than just having one image with all the cross compilers in it?

thanks
-- PMM

#10 lore raw

Re: [Qemu-devel] [PATCH v3 2/3] new: debian docker targets for cross-compiling

Quoted 8 lines · Peter Maydell
Quoted 3 lines · Alex Bennée

This provides a basic Debian install with access to the emdebian cross compilers. The debian-armhf-cross and debian-arm64-cross targets build on the basic Debian image to allow cross compiling to those targets.

Is there a particular reason for creating different docker images for each cross target rather than just having one image with all the cross compilers in it?

Mainly the clashing of build-dependencies. Debian's multi-arch is pretty good but you still can't generally have two arches worth of complex dependencies installed at once.

I did originally have one base docker image with all the compilers and intended to do the dependencies step as part of test-build. However when running as builders the docker images don't actually have network ability so couldn't download them.

--
Alex Bennée

#11 lore raw

Re: [Qemu-devel] [PATCH v3 2/3] new: debian docker targets for cross-compiling

Quoted 12 lines · Alex Bennée
Quoted 8 lines · Peter Maydell
Quoted 3 lines · Alex Bennée

This provides a basic Debian install with access to the emdebian cross compilers. The debian-armhf-cross and debian-arm64-cross targets build on the basic Debian image to allow cross compiling to those targets.

Is there a particular reason for creating different docker images for each cross target rather than just having one image with all the cross compilers in it?

Quoted 8 lines

Mainly the clashing of build-dependencies. Debian's multi-arch is pretty good but you still can't generally have two arches worth of complex dependencies installed at once.

I did originally have one base docker image with all the compilers and intended to do the dependencies step as part of test-build. However when running as builders the docker images don't actually have network ability so couldn't download them.

Yes, having to "prepare", especially to download things, for each test invocation is not resource friendly for CI too.

Fam

#12 lore raw

PATCH v3 3/3 .shippable.yml: new CI provider

In reply to Alex Bennée

Ostensibly Shippable offers a similar set of services as Travis. However they are focused on Docker container based work-flows so we can use our existing containers to run a few extra builds - in this case a bunch of cross-compiled targets on a Debian multiarch system.

---
v3
- reduce matrix to armhf/arm64 which currently work
- use the make docker-image-* build stanzas
- add TARGET_LIST to each build

---
 .shippable.yml | 23 +++++++++++++++++++++++
 MAINTAINERS    |  1 +
 2 files changed, 24 insertions(+)
 create mode 100644 .shippable.yml
.shippable.yml new file +23 -0
new file mode 100644
index 0000000000..e4fa159481
@@ -0,0 +1,23 @@
+language: c
+env:
+  matrix:
+    - IMAGE=debian-armhf-cross
+      CROSS_PREFIX=arm-linux-gnueabihf-
+      TARGET_LIST=arm-softmmu,arm-linux-user
+    - IMAGE=debian-arm64-cross
+      CROSS_PREFIX=aarch64-linux-gnu-
+      TARGET_LIST=aarch64-softmmu,aarch64-linux-user
+    - IMAGE=centos6
+      TARGET_LIST=i386-softmmu,x86_64-softmmu
+build:
+  pre_ci:
+    - make docker-image-${IMAGE}
+  pre_ci_boot:
+    image_name: qemu
+    image_tag: ${IMAGE}
+    pull: false
+    options: "-e HOME=/root"
+  ci:
+    - unset CC
+    - ./configure --cross-prefix=${CROSS_PREFIX} --target-list=${TARGET_LIST}
+    - make -j2
MAINTAINERS +1 -0
index 7afbadaa15..578888d32d 100644
@@ -1805,6 +1805,7 @@ M: Alex Bennée <[email protected]>
 L: [email protected]
 S: Supported
 F: .travis.yml
+F: .shippable.yml
 
 Documentation
 -------------
Signature · 1 line
2.11.0
#13 lore raw

Re: [Qemu-devel] [PATCH v3 3/3] .shippable.yml: new CI provider

Quoted 37 lines · Alex Bennée

Ostensibly Shippable offers a similar set of services as Travis. However they are focused on Docker container based work-flows so we can use our existing containers to run a few extra builds - in this case a bunch of cross-compiled targets on a Debian multiarch system.

---
v3
- reduce matrix to armhf/arm64 which currently work
- use the make docker-image-* build stanzas
- add TARGET_LIST to each build

---
 .shippable.yml | 23 +++++++++++++++++++++++
 MAINTAINERS    |  1 +
 2 files changed, 24 insertions(+)
 create mode 100644 .shippable.yml
.shippable.yml new file +13 -0
new file mode 100644
index 0000000000..e4fa159481
@@ -0,0 +1,23 @@
+language: c
+env:
+  matrix:
+    - IMAGE=debian-armhf-cross
+      CROSS_PREFIX=arm-linux-gnueabihf-
+      TARGET_LIST=arm-softmmu,arm-linux-user
+    - IMAGE=debian-arm64-cross
+      CROSS_PREFIX=aarch64-linux-gnu-
+      TARGET_LIST=aarch64-softmmu,aarch64-linux-user
+    - IMAGE=centos6
+      TARGET_LIST=i386-softmmu,x86_64-softmmu
+build:
+  pre_ci:

.shippable.yml line 23

Quoted 10 lines
.shippable.yml new file +10 -0
+    - make docker-image-${IMAGE}
+  pre_ci_boot:
+    image_name: qemu
+    image_tag: ${IMAGE}
+    pull: false
+    options: "-e HOME=/root"
+  ci:
+    - unset CC
+    - ./configure --cross-prefix=${CROSS_PREFIX} --target-list=${TARGET_LIST}
+    - make -j2

Looks cool!

Quoted 16 lines
MAINTAINERS +1 -0
index 7afbadaa15..578888d32d 100644
@@ -1805,6 +1805,7 @@ M: Alex Bennée <[email protected]>
 L: [email protected]
 S: Supported
 F: .travis.yml
+F: .shippable.yml
 
 Documentation
 -------------
Signature · 1 line
2.11.0

May I propose we merge 'docker testing' section of MAINTAINERS into 'build and test automation' section? I don't know as much about travis (and shippable) but I'm totally fine if you want to have docker tests under your umbrella, and it seems a logical step judging from their names.

Fam

#14 lore raw

Re: [Qemu-devel] [PATCH v3 3/3] .shippable.yml: new CI provider

Quoted 61 lines · Fam Zheng
Quoted 37 lines · Alex Bennée

Ostensibly Shippable offers a similar set of services as Travis. However they are focused on Docker container based work-flows so we can use our existing containers to run a few extra builds - in this case a bunch of cross-compiled targets on a Debian multiarch system.

---
v3
- reduce matrix to armhf/arm64 which currently work
- use the make docker-image-* build stanzas
- add TARGET_LIST to each build

---
 .shippable.yml | 23 +++++++++++++++++++++++
 MAINTAINERS    |  1 +
 2 files changed, 24 insertions(+)
 create mode 100644 .shippable.yml
.shippable.yml new file +13 -0
new file mode 100644
index 0000000000..e4fa159481
@@ -0,0 +1,23 @@
+language: c
+env:
+  matrix:
+    - IMAGE=debian-armhf-cross
+      CROSS_PREFIX=arm-linux-gnueabihf-
+      TARGET_LIST=arm-softmmu,arm-linux-user
+    - IMAGE=debian-arm64-cross
+      CROSS_PREFIX=aarch64-linux-gnu-
+      TARGET_LIST=aarch64-softmmu,aarch64-linux-user
+    - IMAGE=centos6
+      TARGET_LIST=i386-softmmu,x86_64-softmmu
+build:
+  pre_ci:

.shippable.yml line 23

Quoted 10 lines
.shippable.yml new file +10 -0
+    - make docker-image-${IMAGE}
+  pre_ci_boot:
+    image_name: qemu
+    image_tag: ${IMAGE}
+    pull: false
+    options: "-e HOME=/root"
+  ci:
+    - unset CC
+    - ./configure --cross-prefix=${CROSS_PREFIX} --target-list=${TARGET_LIST}
+    - make -j2

Looks cool!

Quoted 10 lines
MAINTAINERS +1 -0
index 7afbadaa15..578888d32d 100644
@@ -1805,6 +1805,7 @@ M: Alex Bennée <[email protected]>
 L: [email protected]
 S: Supported
 F: .travis.yml
+F: .shippable.yml
 
Quoted 11 lines
Quoted 6 lines
MAINTAINERS +0 -1
 Documentation
 -------------
--

2.11.0

May I propose we merge 'docker testing' section of MAINTAINERS into 'build and test automation' section? I don't know as much about travis (and shippable) but I'm totally fine if you want to have docker tests under your umbrella, and it seems a logical step judging from their names.

So:

Build and test automation
-------------------------
M: Alex Bennée <[email protected]>
M: Fam Zheng <[email protected]>
L: [email protected]
S: Maintained
F: .travis.yml
F: .shippable.yml
F: tests/docker/

Or did you want to drop out of the review cycle and concentrate on patchew?

--
Alex Bennée

#15 lore raw

Re: [Qemu-devel] [PATCH v3 3/3] .shippable.yml: new CI provider

Quoted 7 lines · Alex Bennée
Quoted 4 lines

May I propose we merge 'docker testing' section of MAINTAINERS into 'build and test automation' section? I don't know as much about travis (and shippable) but I'm totally fine if you want to have docker tests under your umbrella, and it seems a logical step judging from their names.

So:

Quoted 9 lines

Build and test automation
-------------------------
M: Alex Bennée <[email protected]>
M: Fam Zheng <[email protected]>
L: [email protected]
S: Maintained
F: .travis.yml
F: .shippable.yml
F: tests/docker/

Yes, looks good. Please include a patch in v4.

Quoted 2 lines

Or did you want to drop out of the review cycle and concentrate on patchew?

I would still keep my eyes on tests/docker/, the intent is just for being more compact on MAINTAINERS.

Fam