From a521ea0a13247a16d82c9d72c3fffa3d903a9364 Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Wed, 11 Nov 2020 13:46:57 +1000 Subject: [PATCH] Tweak galaxy CI tests to bring stability (#72578) --- .../library/setup_collections.py | 143 +++++++++--------- .../tasks/install.yml | 1 - .../ansible-galaxy-collection/tasks/main.yml | 35 +---- .../templates/ansible.cfg.j2 | 2 + 4 files changed, 82 insertions(+), 99 deletions(-) diff --git a/test/integration/targets/ansible-galaxy-collection/library/setup_collections.py b/test/integration/targets/ansible-galaxy-collection/library/setup_collections.py index b4e1d0d0e3e..6f1a17f9714 100644 --- a/test/integration/targets/ansible-galaxy-collection/library/setup_collections.py +++ b/test/integration/targets/ansible-galaxy-collection/library/setup_collections.py @@ -56,12 +56,6 @@ options: - The dependencies of the collection. type: dict default: '{}' - wait: - description: - - Whether to wait for each collection's publish step to complete. - - When set to C(no), will only wait on the last publish task. - type: bool - default: false author: - Jordan Borean (@jborean93) ''' @@ -89,6 +83,76 @@ import yaml from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_bytes +from functools import partial +from multiprocessing import dummy as threading + + +def publish_collection(module, collection): + namespace = collection['namespace'] + name = collection['name'] + version = collection['version'] + dependencies = collection['dependencies'] + use_symlink = collection['use_symlink'] + + result = {} + collection_dir = os.path.join(module.tmpdir, "%s-%s-%s" % (namespace, name, version)) + b_collection_dir = to_bytes(collection_dir, errors='surrogate_or_strict') + os.mkdir(b_collection_dir) + + with open(os.path.join(b_collection_dir, b'README.md'), mode='wb') as fd: + fd.write(b"Collection readme") + + galaxy_meta = { + 'namespace': namespace, + 'name': name, + 'version': version, + 'readme': 'README.md', + 'authors': ['Collection author