From 3cd045efd100c5d29340c63d806e656a0dc4bc60 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 1f19ac3f999..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:b651e5964e192c12ef574646a9c724e72fd94615d37d47ffad986408b2097a07 -fedora24@sha256:7b642c5d25b779a3a605fb8f70d9d92972f2004a5266fe364264809899fb1117 -fedora25@sha256:828c71d87f1636f4d09916b8e2d87fc9a615d361a9afed22e8843ffb3d2729d2 -opensuse42.2@sha256:3c59cd694fe69860d299a10afaa84f4e0b3db0c4139232431e9801e1a0775b0a -opensuse42.3@sha256:d62cc5f0de0ffddbd32c73271290a4593613bd94fa09b615ac0c025a10bdbe3c -ubuntu1404@sha256:4372bfbedf2d44e421fc9e5266ffd9d55074b4ad19f81270aeb3ff893245423c -ubuntu1604@sha256:1ce833540387eab6d2de9ece9068ae94e5f58dced696bc3080b276bc7da116a7 -ubuntu1604py3@sha256:3dc2000073c4445e6dbbfd943b0a02e57427435af7e537346e314c90740b13fd +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 5da9eb64d19..6e2356cd256 100644 --- a/test/runner/lib/config.py +++ b/test/runner/lib/config.py @@ -40,6 +40,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 d086e991e32..8bde6ab2704 100644 --- a/test/runner/lib/delegation.py +++ b/test/runner/lib/delegation.py @@ -196,7 +196,7 @@ def delegate_docker(args, exclude, require, integration_targets): 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 2c60da6fe32..aeda05a28fd 100644 --- a/test/runner/lib/util.py +++ b/test/runner/lib/util.py @@ -45,11 +45,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 @@ -700,12 +716,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):