From 92b66e3e31470ab09d503537b692e1cf671a4e51 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 24 Sep 2020 17:34:07 -0700 Subject: [PATCH] CI provider fixes for ansible-test. (#71929) * Make Azure Pipelines resource_prefix lowercase. * Make classification of CI files consistent. * Update package-data sanity test for AZP. --- .../fragments/ansible-test-azp-resource-prefix.yml | 2 ++ .../fragments/ansible-test-change-classification.yml | 2 ++ test/lib/ansible_test/_internal/ci/azp.py | 2 +- test/lib/ansible_test/_internal/classification.py | 11 ++++++++++- test/sanity/code-smell/package-data.py | 1 + 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/ansible-test-azp-resource-prefix.yml create mode 100644 changelogs/fragments/ansible-test-change-classification.yml diff --git a/changelogs/fragments/ansible-test-azp-resource-prefix.yml b/changelogs/fragments/ansible-test-azp-resource-prefix.yml new file mode 100644 index 00000000000..0c0d22f01e6 --- /dev/null +++ b/changelogs/fragments/ansible-test-azp-resource-prefix.yml @@ -0,0 +1,2 @@ +bugfixes: + - ansible-test - The ``resource_prefix`` variable provided to tests running on Azure Pipelines is now converted to lowercase to match other CI providers. diff --git a/changelogs/fragments/ansible-test-change-classification.yml b/changelogs/fragments/ansible-test-change-classification.yml new file mode 100644 index 00000000000..de812b2aea2 --- /dev/null +++ b/changelogs/fragments/ansible-test-change-classification.yml @@ -0,0 +1,2 @@ +bugfixes: + - ansible-test - Change classification using ``--changed`` now consistently handles common configuration files for supported CI providers. diff --git a/test/lib/ansible_test/_internal/ci/azp.py b/test/lib/ansible_test/_internal/ci/azp.py index e001100a87e..1b7a6398bc0 100644 --- a/test/lib/ansible_test/_internal/ci/azp.py +++ b/test/lib/ansible_test/_internal/ci/azp.py @@ -73,7 +73,7 @@ class AzurePipelines(CIProvider): except KeyError as ex: raise MissingEnvironmentVariable(name=ex.args[0]) - prefix = re.sub(r'[^a-zA-Z0-9]+', '-', prefix) + prefix = re.sub(r'[^a-zA-Z0-9]+', '-', prefix).lower() return prefix diff --git a/test/lib/ansible_test/_internal/classification.py b/test/lib/ansible_test/_internal/classification.py index c2f5158163b..8eaf573c114 100644 --- a/test/lib/ansible_test/_internal/classification.py +++ b/test/lib/ansible_test/_internal/classification.py @@ -377,6 +377,16 @@ class PathMapper: minimal = {} + if os.path.sep not in path: + if filename in ( + 'azure-pipelines.yml', + 'shippable.yml', + ): + return all_tests(self.args) # test infrastructure, run all tests + + if is_subdir(path, '.azure-pipelines'): + return all_tests(self.args) # test infrastructure, run all tests + if is_subdir(path, '.github'): return minimal @@ -873,7 +883,6 @@ class PathMapper: if path in ( 'setup.py', - 'shippable.yml', ): return all_tests(self.args) # broad impact, run all tests diff --git a/test/sanity/code-smell/package-data.py b/test/sanity/code-smell/package-data.py index 7525dd73d41..822c11d5dcf 100755 --- a/test/sanity/code-smell/package-data.py +++ b/test/sanity/code-smell/package-data.py @@ -21,6 +21,7 @@ def assemble_files_to_ship(complete_file_list): # All files which are in the repository except these: ignore_patterns = ( # Developer-only tools + '.azure-pipelines/*', '.github/*', '.github/*/*', 'changelogs/fragments/*',