From 8a4caea84f6768ed9c1e67c6f860b2d99e17f4b2 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Tue, 29 Jan 2019 07:29:21 +0000 Subject: [PATCH] ci: Allow DISTROS="debian*32" variable, and KEEP=1 --- .ci/ci_lib.py | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/.ci/ci_lib.py b/.ci/ci_lib.py index 3147877a..d06fedda 100644 --- a/.ci/ci_lib.py +++ b/.ci/ci_lib.py @@ -158,23 +158,37 @@ def make_containers(): firstbit = lambda s: (s+'-').split('-')[0] secondbit = lambda s: (s+'-').split('-')[1] - return [ - { - "distro": firstbit(distro), - "name": "target-%s-%s" % (distro, i), - "hostname": docker_hostname, - "port": BASE_PORT + i, - "python_path": ( - '/usr/bin/python3' - if secondbit(distro) == 'py3' - else '/usr/bin/python' - ) - } - for i, distro in enumerate(DISTROS, 1) - ] + i = 1 + lst = [] + + for distro in DISTROS: + distro, star, count = distro.rpartition('*') + if star: + count = int(count) + else: + count = 1 + + for x in range(count): + lst.append({ + "distro": firstbit(distro), + "name": "target-%s-%s" % (distro, i), + "hostname": docker_hostname, + "port": BASE_PORT + i, + "python_path": ( + '/usr/bin/python3' + if secondbit(distro) == 'py3' + else '/usr/bin/python' + ) + }) + i += 1 + + return lst def start_containers(containers): + if os.environ.get('KEEP'): + return + run_batches([ [ "docker rm -f %(name)s || true" % container,