Skip to contentSkip to conversation

Various docker fixes

PATCH Superseded Alex Bennée 4 participants 14 messages Jul 25, 2017 – Sep 5, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Various docker fixes

Hi,

Phillipe pointed out a few anomalies with the travis.docker image during review which has led to a couple more patches. As they are bug fixes I didn't race to get a pull-req out today for hard-freeze. I will roll a pull-req by the end of the week if there are no objections as I'll be away for the rc1/2 cycles.

Alex Bennée (6):
docker: ensure NOUSER for travis images
docker: fix dirty/stash detection on some systems
docker: ignore submodules when checking diff
docker: docker.py make --no-cache skip checksum test
docker: don't install device-tree-compiler build-deps in travis.docker
docker: reduce noise when building travis.docker

 tests/docker/Makefile.include          | 3 ++-
 tests/docker/docker.py                 | 3 ++-
 tests/docker/dockerfiles/travis.docker | 6 ++++--
 3 files changed, 8 insertions(+), 4 deletions(-)
Signature · 1 line
2.13.0
#1 lore raw

PATCH v2 1/6 docker: ensure NOUSER for travis images

While adding the current user is a useful default behaviour for creating new images it is not appropriate for Travis which already has a default user.

---
 tests/docker/Makefile.include | 1 +
 1 file changed, 1 insertion(+)
tests/docker/Makefile.include +1 -0
index aaab1a4208..d7dafdbd27 100644
@@ -71,6 +71,7 @@ docker-image-debian-ppc64el-cross: docker-image-debian9
 docker-image-debian-s390x-cross: docker-image-debian9
 docker-image-debian-win32-cross: docker-image-debian8-mxe
 docker-image-debian-win64-cross: docker-image-debian8-mxe
+docker-image-travis: NOUSER=1
 
 # Expand all the pre-requistes for each docker image and test combination
 $(foreach i,$(DOCKER_IMAGES), \
Signature · 1 line
2.13.0
#2 lore raw

PATCH v2 2/6 docker: fix dirty/stash detection on some systems

In reply to Alex Bennée

I reported this a while ago but evidently forgot to push the patch upstream. Without this I wasn't seeing the dirty tree state submitted to the docker build which is very confusing.

Reference:
Subject: [PATCH 1/6] tests/docker/Makefile.include: fix diff-index call
Date: Fri, 28 Oct 2016 17:33:34 +0100
Message-Id: <[email protected]>

---
 tests/docker/Makefile.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/docker/Makefile.include +1 -1
index d7dafdbd27..ff580edfad 100644
@@ -20,7 +20,7 @@ IMAGES ?= %
 # Make archive from git repo $1 to tar.gz $2
 make-archive-maybe = $(if $(wildcard $1/*), \
 	$(call quiet-command, \
-		(cd $1; if git diff-index --quiet HEAD -- &>/dev/null; then \
+		(cd $1; if git diff-index --quiet HEAD -- 2>/dev/null; then \
 			git archive -1 HEAD --format=tar.gz; \
 		else \
 			git archive -1 $$(git stash create) --format=tar.gz; \
Signature · 1 line
2.13.0
#3 lore raw

PATCH v2 3/6 docker: ignore submodules when checking diff

In reply to Alex Bennée

The QEMU tree often has dirty submodules in it but this will confuse things as git stash is not going to save their state directly. They are likely just dirty from build files anyway. Ignore them in the diff-index command.

---
 tests/docker/Makefile.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/docker/Makefile.include +1 -1
index ff580edfad..2a560a5327 100644
@@ -20,7 +20,7 @@ IMAGES ?= %
 # Make archive from git repo $1 to tar.gz $2
 make-archive-maybe = $(if $(wildcard $1/*), \
 	$(call quiet-command, \
-		(cd $1; if git diff-index --quiet HEAD -- 2>/dev/null; then \
+		(cd $1; if git diff-index --quiet --ignore-submodules HEAD -- 2>/dev/null; then \
 			git archive -1 HEAD --format=tar.gz; \
 		else \
 			git archive -1 $$(git stash create) --format=tar.gz; \
Signature · 1 line
2.13.0
#4 lore raw

PATCH v2 4/6 docker: docker.py make --no-cache skip checksum test

In reply to Alex Bennée

If you invoke with NOCACHE=1 we pass --no-cache in the argv to docker.py but may still not force a rebuild if the dockerfile checksum hasn't changed. By testing for its presence we can force builds without having to manually remove the docker image.

---
 tests/docker/docker.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/docker/docker.py +2 -1
index ee40ca04d9..aab1648cc5 100755
@@ -261,7 +261,8 @@ class BuildCommand(SubCommand):
         tag = args.tag
 
         dkr = Docker()
-        if dkr.image_matches_dockerfile(tag, dockerfile):
+        if "--no-cache" not in argv and \
+           dkr.image_matches_dockerfile(tag, dockerfile):
             if not args.quiet:
                 print "Image is up to date."
         else:
Signature · 1 line
2.13.0
#5 lore raw

PATCH v2 5/6 docker: don't install device-tree-compiler build-deps in travis.docker

In reply to Alex Bennée

Installing the device-tree-compiler build-deps is a little extreme. We only actually need the binary so include it with the other packages.

---
 tests/docker/dockerfiles/travis.docker | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tests/docker/dockerfiles/travis.docker +1 -2
index 636fa590a5..57ac8e1419 100644
@@ -1,6 +1,5 @@
 FROM quay.io/travisci/travis-ruby
 RUN apt-get update
 RUN apt-get -y build-dep qemu
-RUN apt-get -y build-dep device-tree-compiler
-RUN apt-get -y install python2.7 python-yaml dh-autoreconf gdb strace lsof net-tools
+RUN apt-get -y install device-tree-compiler python2.7 python-yaml dh-autoreconf gdb strace lsof net-tools
 ENV FEATURES pyyaml
Signature · 1 line
2.13.0
Reviewed-by Tested-by on v2 5/6
#6 lore raw

Re: [Qemu-devel] [PATCH for 2.10 v2 5/6] docker: don't install device-tree-compiler build-deps in travis.docker

Quoted 5 lines · Alex Bennée

Installing the device-tree-compiler build-deps is a little extreme. We only actually need the binary so include it with the other packages.

before:

$ docker images qemu:travis --no-trunc --format="{{.Repository}}:{{.Tag}}\t{{.Size}}"

qemu:travis 6.16GB

after:

qemu:travis 5.92GB

not a big win :(

(not a "bugfix" btw)

Quoted 17 lines
---
  tests/docker/dockerfiles/travis.docker | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
tests/docker/dockerfiles/travis.docker +1 -2
index 636fa590a5..57ac8e1419 100644
@@ -1,6 +1,5 @@
  FROM quay.io/travisci/travis-ruby
  RUN apt-get update
  RUN apt-get -y build-dep qemu
-RUN apt-get -y build-dep device-tree-compiler
-RUN apt-get -y install python2.7 python-yaml dh-autoreconf gdb strace lsof net-tools
+RUN apt-get -y install device-tree-compiler python2.7 python-yaml dh-autoreconf gdb strace lsof net-tools
  ENV FEATURES pyyaml
#7 lore raw

Re: [Qemu-devel] [PATCH for 2.10 v2 5/6] docker: don't install device-tree-compiler build-deps in travis.docker

Quoted 10 lines · Philippe Mathieu-Daudé

before:

$ docker images qemu:travis --no-trunc 
--format="{{.Repository}}:{{.Tag}}\t{{.Size}}"

qemu:travis 6.16GB

after:

qemu:travis 5.92GB

I mis-selected, the correct size this patch applied:

qemu:travis 6.03GB

Quoted 2 lines

not a big win :(

#8 lore raw

Re: [Qemu-devel] [PATCH for 2.10 v2 5/6] docker: don't install device-tree-compiler build-deps in travis.docker

In reply to Philippe Mathieu-Daudé
Quoted 16 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Alex Bennée

Installing the device-tree-compiler build-deps is a little extreme. We only actually need the binary so include it with the other packages.

before:

$ docker images qemu:travis --no-trunc
--format="{{.Repository}}:{{.Tag}}\t{{.Size}}"

qemu:travis 6.16GB

after:

Quoted 8 lines

qemu:travis 5.92GB

not a big win :(

(not a "bugfix" btw)

It's arguable - it was certainly wrong as we just need the compiler and I'm not sure build-dep actually would have pulled it on (although the qemu build-dep probably does).

Quoted 5 lines
Quoted 5 lines
---
  tests/docker/dockerfiles/travis.docker | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 13 lines

tests/docker/dockerfiles/travis.docker line 5

Quoted 13 lines
tests/docker/dockerfiles/travis.docker +1 -2
index 636fa590a5..57ac8e1419 100644
@@ -1,6 +1,5 @@
  FROM quay.io/travisci/travis-ruby
  RUN apt-get update
  RUN apt-get -y build-dep qemu
-RUN apt-get -y build-dep device-tree-compiler
-RUN apt-get -y install python2.7 python-yaml dh-autoreconf gdb strace lsof net-tools
+RUN apt-get -y install device-tree-compiler python2.7 python-yaml dh-autoreconf gdb strace lsof net-tools
  ENV FEATURES pyyaml

--
Alex Bennée

#9 lore raw

PATCH v2 6/6 docker: reduce noise when building travis.docker

In reply to Alex Bennée

Set the DEBIAN_FRONTEND and locale env vars to stop apt complaining so much as we build the image.

---
 tests/docker/dockerfiles/travis.docker | 3 +++
 1 file changed, 3 insertions(+)
tests/docker/dockerfiles/travis.docker +3 -0
index 57ac8e1419..605b6e429b 100644
@@ -1,4 +1,7 @@
 FROM quay.io/travisci/travis-ruby
+ENV DEBIAN_FRONTEND noninteractive
+ENV LANG en_US.UTF-8
+ENV LC_ALL en_US.UTF-8
 RUN apt-get update
 RUN apt-get -y build-dep qemu
 RUN apt-get -y install device-tree-compiler python2.7 python-yaml dh-autoreconf gdb strace lsof net-tools
Signature · 1 line
2.13.0
#10 lore raw

Re: [Qemu-devel] [PATCH for 2.10 v2 6/6] docker: reduce noise when building travis.docker

Quoted 14 lines · Alex Bennée

Set the DEBIAN_FRONTEND and locale env vars to stop apt complaining so much as we build the image.

---
 tests/docker/dockerfiles/travis.docker | 3 +++
 1 file changed, 3 insertions(+)
tests/docker/dockerfiles/travis.docker +0 -0
index 57ac8e1419..605b6e429b 100644

tests/docker/dockerfiles/travis.docker line 4

Quoted 4 lines
tests/docker/dockerfiles/travis.docker +3 -0
@@ -1,4 +1,7 @@
 FROM quay.io/travisci/travis-ruby
+ENV DEBIAN_FRONTEND noninteractive
+ENV LANG en_US.UTF-8
+ENV LC_ALL en_US.UTF-8

LANG is pointless if LC_ALL is set, as LC_ALL takes precedence.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Reviewed-by Tested-by on v2 6/6
#11 lore raw

Re: [Qemu-devel] [PATCH for 2.10 v2 6/6] docker: reduce noise when building travis.docker

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

Set the DEBIAN_FRONTEND and locale env vars to stop apt complaining so much as we build the image.

---
  tests/docker/dockerfiles/travis.docker | 3 +++
  1 file changed, 3 insertions(+)
tests/docker/dockerfiles/travis.docker +0 -0
index 57ac8e1419..605b6e429b 100644

tests/docker/dockerfiles/travis.docker line 4

Quoted 4 lines
tests/docker/dockerfiles/travis.docker +3 -0
@@ -1,4 +1,7 @@
  FROM quay.io/travisci/travis-ruby
+ENV DEBIAN_FRONTEND noninteractive
+ENV LANG en_US.UTF-8
+ENV LC_ALL en_US.UTF-8

can be one-lined:
ENV DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 maybe add "default env vars set using travis (see [link])" in message?

(not a bugfix)

Quoted 4 lines
tests/docker/dockerfiles/travis.docker +0 -0
  RUN apt-get update
  RUN apt-get -y build-dep qemu
  RUN apt-get -y install device-tree-compiler python2.7 python-yaml dh-autoreconf gdb strace lsof net-tools
#12 lore raw
In reply to Alex Bennée
Quoted 8 lines · Alex Bennée

Hi,

Phillipe pointed out a few anomalies with the travis.docker image during review which has led to a couple more patches. As they are bug fixes I didn't race to get a pull-req out today for hard-freeze. I will roll a pull-req by the end of the week if there are no objections as I'll be away for the rc1/2 cycles.

Quoted 7 lines

Alex Bennée (6):
docker: ensure NOUSER for travis images
docker: fix dirty/stash detection on some systems
docker: ignore submodules when checking diff
docker: docker.py make --no-cache skip checksum test
docker: don't install device-tree-compiler build-deps in travis.docker
docker: reduce noise when building travis.docker

Thanks, I've queued patches 1, 4, 5, 6 for 2.11. I intend to drop the code touched by 2 and 3 with a dedicated script:

https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg06349.html
https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg06358.html

(It would be great if you can give some test/review there :)

Fam

Quoted 9 lines
 tests/docker/Makefile.include          | 3 ++-
 tests/docker/docker.py                 | 3 ++-
 tests/docker/dockerfiles/travis.docker | 6 ++++--
 3 files changed, 8 insertions(+), 4 deletions(-)
Signature · 1 line
2.13.0
#13 lore raw
Quoted 17 lines · Fam Zheng
Quoted 8 lines · Alex Bennée

Hi,

Phillipe pointed out a few anomalies with the travis.docker image during review which has led to a couple more patches. As they are bug fixes I didn't race to get a pull-req out today for hard-freeze. I will roll a pull-req by the end of the week if there are no objections as I'll be away for the rc1/2 cycles.

Quoted 7 lines

Alex Bennée (6):
docker: ensure NOUSER for travis images
docker: fix dirty/stash detection on some systems
docker: ignore submodules when checking diff
docker: docker.py make --no-cache skip checksum test
docker: don't install device-tree-compiler build-deps in travis.docker
docker: reduce noise when building travis.docker

Quoted 7 lines

Thanks, I've queued patches 1, 4, 5, 6 for 2.11. I intend to drop the code touched by 2 and 3 with a dedicated script:

https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg06349.html
https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg06358.html

(It would be great if you can give some test/review there :)

Cool - I shall have a look.

Quoted 12 lines

Fam

Quoted 9 lines
 tests/docker/Makefile.include          | 3 ++-
 tests/docker/docker.py                 | 3 ++-
 tests/docker/dockerfiles/travis.docker | 6 ++++--
 3 files changed, 8 insertions(+), 4 deletions(-)

--
2.13.0

--
Alex Bennée