From f47bc03599eedc48753d2cd5e1bea177f35e6133 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 28 Feb 2023 13:21:11 -0800 Subject: [PATCH] Relocate the AZP entry point scripts (#80114) Scripts previously under `test/utils/shippable/` are now under `.azure-pipelines/commands/` instead. --- .azure-pipelines/azure-pipelines.yml | 2 +- .../commands}/alpine.sh | 0 .../commands}/cloud.sh | 0 .../commands/entry-point.sh | 2 +- .../commands}/fedora.sh | 0 .../commands}/freebsd.sh | 0 .../commands}/galaxy.sh | 0 .../commands}/generic.sh | 0 .../commands}/i.sh | 2 +- .../commands}/incidental/ios.sh | 0 .../commands}/incidental/network.sh | 0 .../commands}/incidental/vyos.sh | 0 .../commands}/incidental/windows.sh | 0 .../commands}/linux.sh | 0 .../commands}/macos.sh | 0 .../commands}/remote.sh | 0 .../commands}/rhel.sh | 0 .../commands}/sanity.sh | 0 .../commands}/ubuntu.sh | 0 .../commands}/units.sh | 0 .../commands}/windows.sh | 0 .../_internal/classification/__init__.py | 76 +++++++++---------- test/sanity/code-smell/package-data.py | 3 - 23 files changed, 41 insertions(+), 44 deletions(-) rename {test/utils/shippable => .azure-pipelines/commands}/alpine.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/cloud.sh (100%) rename test/utils/shippable/shippable.sh => .azure-pipelines/commands/entry-point.sh (97%) rename {test/utils/shippable => .azure-pipelines/commands}/fedora.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/freebsd.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/galaxy.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/generic.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/i.sh (84%) rename {test/utils/shippable => .azure-pipelines/commands}/incidental/ios.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/incidental/network.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/incidental/vyos.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/incidental/windows.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/linux.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/macos.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/remote.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/rhel.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/sanity.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/ubuntu.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/units.sh (100%) rename {test/utils/shippable => .azure-pipelines/commands}/windows.sh (100%) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index 6cb7feb1ad4..1278b833143 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -27,7 +27,7 @@ variables: - name: coverageBranches value: devel - name: entryPoint - value: test/utils/shippable/shippable.sh + value: .azure-pipelines/commands/entry-point.sh - name: fetchDepth value: 500 diff --git a/test/utils/shippable/alpine.sh b/.azure-pipelines/commands/alpine.sh similarity index 100% rename from test/utils/shippable/alpine.sh rename to .azure-pipelines/commands/alpine.sh diff --git a/test/utils/shippable/cloud.sh b/.azure-pipelines/commands/cloud.sh similarity index 100% rename from test/utils/shippable/cloud.sh rename to .azure-pipelines/commands/cloud.sh diff --git a/test/utils/shippable/shippable.sh b/.azure-pipelines/commands/entry-point.sh similarity index 97% rename from test/utils/shippable/shippable.sh rename to .azure-pipelines/commands/entry-point.sh index 8fa12482f23..0a9e571be14 100755 --- a/test/utils/shippable/shippable.sh +++ b/.azure-pipelines/commands/entry-point.sh @@ -59,4 +59,4 @@ fi ansible-test env --dump --show --timeout "${timeout}" --color -v -"test/utils/shippable/${script}.sh" "${test}" +".azure-pipelines/commands/${script}.sh" "${test}" diff --git a/test/utils/shippable/fedora.sh b/.azure-pipelines/commands/fedora.sh similarity index 100% rename from test/utils/shippable/fedora.sh rename to .azure-pipelines/commands/fedora.sh diff --git a/test/utils/shippable/freebsd.sh b/.azure-pipelines/commands/freebsd.sh similarity index 100% rename from test/utils/shippable/freebsd.sh rename to .azure-pipelines/commands/freebsd.sh diff --git a/test/utils/shippable/galaxy.sh b/.azure-pipelines/commands/galaxy.sh similarity index 100% rename from test/utils/shippable/galaxy.sh rename to .azure-pipelines/commands/galaxy.sh diff --git a/test/utils/shippable/generic.sh b/.azure-pipelines/commands/generic.sh similarity index 100% rename from test/utils/shippable/generic.sh rename to .azure-pipelines/commands/generic.sh diff --git a/test/utils/shippable/i.sh b/.azure-pipelines/commands/i.sh similarity index 84% rename from test/utils/shippable/i.sh rename to .azure-pipelines/commands/i.sh index efa2866d2e9..2b3eed038ba 100755 --- a/test/utils/shippable/i.sh +++ b/.azure-pipelines/commands/i.sh @@ -11,4 +11,4 @@ script="${args[1]}" IFS='/' test="${args[*]:1}" -"test/utils/shippable/incidental/${script}.sh" "${test}" +".azure-pipelines/commands/incidental/${script}.sh" "${test}" diff --git a/test/utils/shippable/incidental/ios.sh b/.azure-pipelines/commands/incidental/ios.sh similarity index 100% rename from test/utils/shippable/incidental/ios.sh rename to .azure-pipelines/commands/incidental/ios.sh diff --git a/test/utils/shippable/incidental/network.sh b/.azure-pipelines/commands/incidental/network.sh similarity index 100% rename from test/utils/shippable/incidental/network.sh rename to .azure-pipelines/commands/incidental/network.sh diff --git a/test/utils/shippable/incidental/vyos.sh b/.azure-pipelines/commands/incidental/vyos.sh similarity index 100% rename from test/utils/shippable/incidental/vyos.sh rename to .azure-pipelines/commands/incidental/vyos.sh diff --git a/test/utils/shippable/incidental/windows.sh b/.azure-pipelines/commands/incidental/windows.sh similarity index 100% rename from test/utils/shippable/incidental/windows.sh rename to .azure-pipelines/commands/incidental/windows.sh diff --git a/test/utils/shippable/linux.sh b/.azure-pipelines/commands/linux.sh similarity index 100% rename from test/utils/shippable/linux.sh rename to .azure-pipelines/commands/linux.sh diff --git a/test/utils/shippable/macos.sh b/.azure-pipelines/commands/macos.sh similarity index 100% rename from test/utils/shippable/macos.sh rename to .azure-pipelines/commands/macos.sh diff --git a/test/utils/shippable/remote.sh b/.azure-pipelines/commands/remote.sh similarity index 100% rename from test/utils/shippable/remote.sh rename to .azure-pipelines/commands/remote.sh diff --git a/test/utils/shippable/rhel.sh b/.azure-pipelines/commands/rhel.sh similarity index 100% rename from test/utils/shippable/rhel.sh rename to .azure-pipelines/commands/rhel.sh diff --git a/test/utils/shippable/sanity.sh b/.azure-pipelines/commands/sanity.sh similarity index 100% rename from test/utils/shippable/sanity.sh rename to .azure-pipelines/commands/sanity.sh diff --git a/test/utils/shippable/ubuntu.sh b/.azure-pipelines/commands/ubuntu.sh similarity index 100% rename from test/utils/shippable/ubuntu.sh rename to .azure-pipelines/commands/ubuntu.sh diff --git a/test/utils/shippable/units.sh b/.azure-pipelines/commands/units.sh similarity index 100% rename from test/utils/shippable/units.sh rename to .azure-pipelines/commands/units.sh diff --git a/test/utils/shippable/windows.sh b/.azure-pipelines/commands/windows.sh similarity index 100% rename from test/utils/shippable/windows.sh rename to .azure-pipelines/commands/windows.sh diff --git a/test/lib/ansible_test/_internal/classification/__init__.py b/test/lib/ansible_test/_internal/classification/__init__.py index 5c7009488a9..3cf6044e528 100644 --- a/test/lib/ansible_test/_internal/classification/__init__.py +++ b/test/lib/ansible_test/_internal/classification/__init__.py @@ -662,21 +662,54 @@ class PathMapper: def _classify_ansible(self, path: str) -> t.Optional[dict[str, str]]: """Return the classification for the given path using rules specific to Ansible.""" + dirname = os.path.dirname(path) + filename = os.path.basename(path) + name, ext = os.path.splitext(filename) + + minimal: dict[str, str] = {} + + # Early classification that needs to occur before common classification belongs here. + if path.startswith('test/units/compat/'): return { 'units': 'test/units/', } + if dirname == '.azure-pipelines/commands': + test_map = { + 'cloud.sh': 'integration:cloud/', + 'linux.sh': 'integration:all', + 'network.sh': 'network-integration:all', + 'remote.sh': 'integration:all', + 'sanity.sh': 'sanity:all', + 'units.sh': 'units:all', + 'windows.sh': 'windows-integration:all', + } + + test_match = test_map.get(filename) + + if test_match: + test_command, test_target = test_match.split(':') + + return { + test_command: test_target, + } + + cloud_target = f'cloud/{name}/' + + if cloud_target in self.integration_targets_by_alias: + return { + 'integration': cloud_target, + } + + # Classification common to both ansible and collections. + result = self._classify_common(path) if result is not None: return result - dirname = os.path.dirname(path) - filename = os.path.basename(path) - name, ext = os.path.splitext(filename) - - minimal: dict[str, str] = {} + # Classification here is specific to ansible, and runs after common classification. if path.startswith('bin/'): return all_tests(self.args) # broad impact, run all tests @@ -792,39 +825,6 @@ class PathMapper: if path.startswith('test/support/'): return all_tests(self.args) # test infrastructure, run all tests - if path.startswith('test/utils/shippable/'): - if dirname == 'test/utils/shippable': - test_map = { - 'cloud.sh': 'integration:cloud/', - 'linux.sh': 'integration:all', - 'network.sh': 'network-integration:all', - 'remote.sh': 'integration:all', - 'sanity.sh': 'sanity:all', - 'units.sh': 'units:all', - 'windows.sh': 'windows-integration:all', - } - - test_match = test_map.get(filename) - - if test_match: - test_command, test_target = test_match.split(':') - - return { - test_command: test_target, - } - - cloud_target = 'cloud/%s/' % name - - if cloud_target in self.integration_targets_by_alias: - return { - 'integration': cloud_target, - } - - return all_tests(self.args) # test infrastructure, run all tests - - if path.startswith('test/utils/'): - return minimal - if '/' not in path: if path in ( '.gitattributes', diff --git a/test/sanity/code-smell/package-data.py b/test/sanity/code-smell/package-data.py index 0c6e76134e4..38509f1da63 100644 --- a/test/sanity/code-smell/package-data.py +++ b/test/sanity/code-smell/package-data.py @@ -29,9 +29,6 @@ def assemble_files_to_ship(complete_file_list): 'hacking/ticket_stubs/*', 'test/sanity/code-smell/botmeta.*', 'test/sanity/code-smell/release-names.*', - 'test/utils/*', - 'test/utils/*/*', - 'test/utils/*/*/*', 'test/results/.tmp/*', 'test/results/.tmp/*/*', 'test/results/.tmp/*/*/*',