.ci: allow containers for different jobs to run simultaneously

pull/564/head
David Wilson 5 years ago
parent c413d53144
commit ad7185444d

@ -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 "

@ -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)

Loading…
Cancel
Save