All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3] tests/docker: support proxy / corporate firewall
@ 2017-03-06 20:55 Philippe Mathieu-Daudé
  2017-03-07 10:21 ` Fam Zheng
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-03-06 20:55 UTC (permalink / raw)
  To: Alex Bennée, Fam Zheng; +Cc: Philippe Mathieu-Daudé, qemu-devel

if ftp_proxy/http_proxy/https_proxy standard environment variables available,
pass them to the docker daemon to build images.
this is required when building behind corporate proxy/firewall, but also help
when using local cache server (ie: apt/yum).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---

v3: corrected test example
v2: use Fam Zheng's pythonized one-line,
    renamed env vars to lowercase.

debian builds can be tested using Sameer Naik docker image
(see https://github.com/sameersbn/docker-apt-cacher-ng#quickstart)

$ docker run --name apt-cacher-ng -d --restart=always \
  --publish 3142:3142 \
  --volume /var/cache/apt-cacher-ng:/var/cache/apt-cacher-ng \
  --privileged \
  sameersbn/apt-cacher-ng:latest

$ HTTP_PROXY=http://172.17.0.1:3142 make docker-test-build@debian-armhf-cross
                    ^
                    +-- docker gateway extracted with:
                    
$ docker inspect apt-cacher-ng | jq '[.. | objects | ."Gateway"] | unique'
[
  "172.17.0.1"
]

 tests/docker/docker.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 9fd32ab5fa..8747f6a440 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -28,6 +28,9 @@ from shutil import copy, rmtree
 from pwd import getpwuid
 
 
+FILTERED_ENV_NAMES = ['ftp_proxy', 'http_proxy', 'https_proxy']
+
+
 DEVNULL = open(os.devnull, 'wb')
 
 
@@ -272,6 +275,9 @@ class BuildCommand(SubCommand):
                 _copy_binary_with_libs(args.include_executable,
                                        docker_dir)
 
+            argv += ["--build-arg=" + k.lower() + "=" + v
+                        for k, v in os.environ.iteritems()
+                        if k.lower() in FILTERED_ENV_NAMES]
             dkr.build_image(tag, docker_dir, dockerfile,
                             quiet=args.quiet, user=args.user, argv=argv)
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH v3] tests/docker: support proxy / corporate firewall
  2017-03-06 20:55 [Qemu-devel] [PATCH v3] tests/docker: support proxy / corporate firewall Philippe Mathieu-Daudé
@ 2017-03-07 10:21 ` Fam Zheng
  0 siblings, 0 replies; 2+ messages in thread
From: Fam Zheng @ 2017-03-07 10:21 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: Alex Bennée, qemu-devel

On Mon, 03/06 17:55, Philippe Mathieu-Daudé wrote:
> if ftp_proxy/http_proxy/https_proxy standard environment variables available,
> pass them to the docker daemon to build images.
> this is required when building behind corporate proxy/firewall, but also help
> when using local cache server (ie: apt/yum).
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Queued for 2.10, thanks.

Fam

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-07 10:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-06 20:55 [Qemu-devel] [PATCH v3] tests/docker: support proxy / corporate firewall Philippe Mathieu-Daudé
2017-03-07 10:21 ` Fam Zheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.