From b1aef381f83a77927e271be831d36862f22207a1 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 16 Aug 2018 21:16:15 -0700 Subject: [PATCH] Switch distro test containers to quay.io images. (cherry picked from commit 773c0982b0d0f1c7a045a0a92ca0c0485affc814) --- test/runner/completion/docker.txt | 21 +++++++++++---------- test/runner/lib/config.py | 1 + test/runner/lib/delegation.py | 2 +- test/runner/lib/util.py | 25 +++++++++++++++++++------ 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/test/runner/completion/docker.txt b/test/runner/completion/docker.txt index ef1d2cd6ef3..dc673cd27d3 100644 --- a/test/runner/completion/docker.txt +++ b/test/runner/completion/docker.txt @@ -1,10 +1,11 @@ -centos6@sha256:41eb4b870ce400202945ccf572d45bf5f2f5ebb50e9dee244de73b9d0278db30 -centos7@sha256:bd571611112cccefdaa951ea640177cbb77c8ee011f958d2562781d90594ea9c -default@sha256:424161033bf1342bc463c27c5fad182c171aa3bc17b3c1fe7aac44623cc8d304 -fedora24@sha256:7b642c5d25b779a3a605fb8f70d9d92972f2004a5266fe364264809899fb1117 -fedora25@sha256:828c71d87f1636f4d09916b8e2d87fc9a615d361a9afed22e8843ffb3d2729d2 -opensuse42.2@sha256:3c59cd694fe69860d299a10afaa84f4e0b3db0c4139232431e9801e1a0775b0a -opensuse42.3@sha256:d62cc5f0de0ffddbd32c73271290a4593613bd94fa09b615ac0c025a10bdbe3c -ubuntu1404@sha256:ba27d23e815a4c3fb361001aea2ef70241d66f08bdf962cf5717037e882ff78a -ubuntu1604@sha256:ff3898ac817a10ec7129f6483721a717ed0d98c6ba42c27be1472d73908568da -ubuntu1604py3@sha256:f0b7883eb3f17ee7cb3a77f4aeea0d743101e103f93a76f4f5120aed9c44c0bc +default name=ansible/ansible:default@sha256:b651e5964e192c12ef574646a9c724e72fd94615d37d47ffad986408b2097a07 +centos6 name=quay.io/ansible/centos6-test-container:1.4.0 +centos7 name=quay.io/ansible/centos7-test-container:1.4.0 +fedora24 name=quay.io/ansible/fedora24-test-container:1.4.0 +fedora25 name=quay.io/ansible/fedora25-test-container:1.4.0 +fedora26py3 name=quay.io/ansible/fedora26py3-test-container:1.4.0 +fedora27py3 name=quay.io/ansible/fedora27py3-test-container:1.4.0 +opensuse42.3 name=quay.io/ansible/opensuse42.3-test-container:1.4.0 +ubuntu1404 name=quay.io/ansible/ubuntu1404-test-container:1.4.0 +ubuntu1604 name=quay.io/ansible/ubuntu1604-test-container:1.4.0 +ubuntu1604py3 name=quay.io/ansible/ubuntu1604py3-test-container:1.4.0 diff --git a/test/runner/lib/config.py b/test/runner/lib/config.py index 755030712b6..85526519ca6 100644 --- a/test/runner/lib/config.py +++ b/test/runner/lib/config.py @@ -38,6 +38,7 @@ class EnvironmentConfig(CommonConfig): self.python = args.tox # type: str self.docker = docker_qualify_image(args.docker) # type: str + self.docker_raw = args.docker # type: str self.remote = args.remote # type: str self.docker_privileged = args.docker_privileged if 'docker_privileged' in args else False # type: bool diff --git a/test/runner/lib/delegation.py b/test/runner/lib/delegation.py index 55ac881eba8..78913b9c0f2 100644 --- a/test/runner/lib/delegation.py +++ b/test/runner/lib/delegation.py @@ -173,7 +173,7 @@ def delegate_docker(args, exclude, require): if isinstance(args, TestConfig): if args.coverage and not args.coverage_label: - image_label = re.sub('^ansible/ansible:', '', args.docker) + image_label = args.docker_raw image_label = re.sub('[^a-zA-Z0-9]+', '-', image_label) cmd += ['--coverage-label', 'docker-%s' % image_label] diff --git a/test/runner/lib/util.py b/test/runner/lib/util.py index 3e9c6bd0a0a..20bb1a6bdff 100644 --- a/test/runner/lib/util.py +++ b/test/runner/lib/util.py @@ -39,11 +39,27 @@ def get_docker_completion(): with open('test/runner/completion/docker.txt', 'r') as completion_fd: images = completion_fd.read().splitlines() - DOCKER_COMPLETION.update(dict((i.split('@')[0], i) for i in images)) + DOCKER_COMPLETION.update(dict(kvp for kvp in [parse_docker_completion(i) for i in images] if kvp)) return DOCKER_COMPLETION +def parse_docker_completion(value): + """ + :type value: str + :rtype: tuple[str, dict[str, str]] + """ + values = value.split() + + if not values: + return None + + name = values[0] + data = dict((kvp[0], kvp[1] if len(kvp) > 1 else '') for kvp in [item.split('=', 1) for item in values[1:]]) + + return name, data + + def is_shippable(): """ :rtype: bool @@ -620,12 +636,9 @@ def docker_qualify_image(name): :type name: str :rtype: str """ - if not name or any((c in name) for c in ('/', ':')): - return name - - name = get_docker_completion().get(name, name) + config = get_docker_completion().get(name, {}) - return 'ansible/ansible:%s' % name + return config.get('name', name) def parse_to_dict(pattern, value):