From ad7185444dd7787e766b634ee8186a463bce7b02 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Mon, 18 Feb 2019 18:00:02 +0000 Subject: [PATCH] .ci: allow containers for different jobs to run simultaneously --- .ci/ci_lib.py | 8 +++++--- .ci/debops_common_tests.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.ci/ci_lib.py b/.ci/ci_lib.py index d4f32f55..bc50d6f8 100644 --- a/.ci/ci_lib.py +++ b/.ci/ci_lib.py @@ -165,7 +165,7 @@ def image_for_distro(distro): return 'mitogen/%s-test' % (distro.partition('-')[0],) -def make_containers(): +def make_containers(name_prefix='', port_offset=0): docker_hostname = get_docker_hostname() firstbit = lambda s: (s+'-').split('-')[0] secondbit = lambda s: (s+'-').split('-')[1] @@ -183,9 +183,9 @@ def make_containers(): for x in range(count): lst.append({ "distro": firstbit(distro), - "name": "target-%s-%s" % (distro, i), + "name": name_prefix + ("target-%s-%s" % (distro, i)), "hostname": docker_hostname, - "port": BASE_PORT + i, + "port": BASE_PORT + i + port_offset, "python_path": ( '/usr/bin/python3' if secondbit(distro) == 'py3' @@ -207,6 +207,8 @@ def start_containers(containers): "docker run " "--rm " "--detach " + "--privileged " + "--cap-add=SYS_PTRACE " "--publish 0.0.0.0:%(port)s:22/tcp " "--hostname=%(name)s " "--name=%(name)s " diff --git a/.ci/debops_common_tests.py b/.ci/debops_common_tests.py index 8e9f2953..6553ccea 100755 --- a/.ci/debops_common_tests.py +++ b/.ci/debops_common_tests.py @@ -20,7 +20,7 @@ docker_hostname = ci_lib.get_docker_hostname() with ci_lib.Fold('docker_setup'): - containers = ci_lib.make_containers() + containers = ci_lib.make_containers(port_offset=500, name_prefix='debops-') ci_lib.start_containers(containers)