From 2d4d354cb116da9d6f6b08b5c70b4627a8ebb690 Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Wed, 2 Aug 2023 21:44:49 +0200 Subject: [PATCH] Remove BOTMETA.yml and sanity tests for it (#81198) (#81264) (cherry picked from commit 39ef570e16e1b4755df63eee8797b29b5710be17) --- .github/BOTMETA.yml | 137 ------------------ test/sanity/code-smell/botmeta.json | 4 - test/sanity/code-smell/botmeta.py | 89 ------------ .../sanity/code-smell/botmeta.requirements.in | 2 - .../code-smell/botmeta.requirements.txt | 5 - 5 files changed, 237 deletions(-) delete mode 100644 .github/BOTMETA.yml delete mode 100644 test/sanity/code-smell/botmeta.json delete mode 100644 test/sanity/code-smell/botmeta.py delete mode 100644 test/sanity/code-smell/botmeta.requirements.in delete mode 100644 test/sanity/code-smell/botmeta.requirements.txt diff --git a/.github/BOTMETA.yml b/.github/BOTMETA.yml deleted file mode 100644 index 7000d29d2ee..00000000000 --- a/.github/BOTMETA.yml +++ /dev/null @@ -1,137 +0,0 @@ -automerge: false -collection_redirect: true -notifications: false -files: - $module_utils/csharp: &id001 - labels: windows - maintainers: $team_windows_core - support: core - $module_utils/network: - labels: networking - $module_utils/network/common: - maintainers: $team_networking - support: network - $module_utils/powershell: *id001 - $modules: - ignored: ryansb tomaszkiewicz - $modules/lineinfile.py: $team_ansible samdoran - $modules/stat.py: - ignored: bpennypacker - $modules/unarchive.py: - ignored: dagwieers - labels: m:unarchive - maintainers: pileofrogs - $modules/add_host.py: - ignored: skvidal - maintainers: $team_ansible - $modules/get_url.py: ptux - $modules/uri.py: - ignored: romeotheriault - maintainers: $team_ansible - $modules/pip.py: Lujeni webknjaz - $modules//yum.py: - ignored: skvidal - maintainers: $team_ansible kustodian - $modules/user.py: $team_ansible samdoran - $modules/pause.py: samdoran - $modules/wait_for.py: gregswift - $plugins/cliconf/: - labels: networking - $plugins/connection/psrp.py: *id001 - $plugins/connection/winrm.py: *id001 - $plugins/doc_fragments/url_windows.py: - labels: windows - maintainers: $team_windows_core - support: core - $plugins/httpapi: - labels: networking - maintainers: $team_networking - support: network - $plugins/netconf/: - labels: networking - maintainers: $team_networking - support: network - $plugins/shell/powershell.py: *id001 - $plugins/terminal/: - labels: networking - $plugins/terminal/__init__.py: - support: network - .github/BOTMETA.yml: - labels: botmeta - support: core - hacking/report.py: - notified: mattclay - hacking/shippable/: - notified: mattclay - lib/ansible/cli/scripts/ansible_connection_cli_stub.py: - keywords: - - persistent connection - labels: networking - lib/ansible/config/ansible_builtin_runtime.yml: - labels: runtime - maintainers: gundalow - lib/ansible/executor/powershell: *id001 - lib/ansible/inventory: - keywords: - - core inventory - - inventory - - inventory parsing - lib/ansible/playbook/handler.py: - keywords: - - handlers - lib/ansible/playbook/role: - keywords: - - roles path - - roles_path - - role - - role path - lib/ansible/playbook/role/include.py: - keywords: - - include role - - include_role - - role include - lib/ansible/playbook/role/requirement.py: - keywords: - - role dependencies - - role dep - - role dependency - lib/ansible/release.py: - notified: mattclay nitzmahone - lib/ansible/template: - keywords: - - jinja - - jinja2 - lib/ansible/utils/collection_loader.py: - notified: mattclay nitzmahone - test/integration/targets/incidental_: - notified: mattclay - test/lib/: - notified: mattclay - test/lib/ansible_test/_util/controller/sanity/validate-modules: - keywords: - - validate-modules - notified: - - mattclay - test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py: - notified: - - gundalow - - sivel - test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py: - notified: - - gundalow - - sivel - test/sanity/: - notified: mattclay - test/sanity/ignore.txt: - notified: tremble - test/support/: - notified: mattclay - test/utils/shippable/: - notified: mattclay -macros: - module_utils: lib/ansible/module_utils - modules: lib/ansible/modules - plugins: lib/ansible/plugins - team_ansible: [] - team_networking: Qalthos ganeshrn trishnaguha justjais NilashishC danielmellado rohitthakur2590 GomathiselviS - team_windows_core: nitzmahone jborean93 diff --git a/test/sanity/code-smell/botmeta.json b/test/sanity/code-smell/botmeta.json deleted file mode 100644 index 56455d209bb..00000000000 --- a/test/sanity/code-smell/botmeta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "no_targets": true, - "output": "path-line-column-message" -} diff --git a/test/sanity/code-smell/botmeta.py b/test/sanity/code-smell/botmeta.py deleted file mode 100644 index 985c8f9f0c2..00000000000 --- a/test/sanity/code-smell/botmeta.py +++ /dev/null @@ -1,89 +0,0 @@ -"""Make sure the data in BOTMETA.yml is valid""" -from __future__ import annotations - -import glob -import os -import re -import sys -import yaml - -from voluptuous import All, Any, Match, MultipleInvalid, Required, Schema -from voluptuous.humanize import humanize_error - -from ansible.module_utils.six import string_types - - -def main(): - """Validate BOTMETA""" - path = '.github/BOTMETA.yml' - - try: - with open(path, 'r') as f_path: - botmeta = yaml.safe_load(f_path) - except yaml.error.MarkedYAMLError as ex: - print('%s:%d:%d: YAML load failed: %s' % (path, ex.context_mark.line + 1, ex.context_mark.column + 1, re.sub(r'\s+', ' ', str(ex)))) - sys.exit() - except Exception as ex: # pylint: disable=broad-except - print('%s:%d:%d: YAML load failed: %s' % (path, 0, 0, re.sub(r'\s+', ' ', str(ex)))) - sys.exit() - - list_string_types = list(string_types) - - files_schema = Any( - Schema(*string_types), - Schema({ - 'ignored': Any(list_string_types, *string_types), - 'keywords': Any(list_string_types, *string_types), - 'labels': Any(list_string_types, *string_types), - 'maintainers': Any(list_string_types, *string_types), - 'migrated_to': All( - Any(*string_types), - Match(r'^\w+\.\w+$'), - ), - 'notified': Any(list_string_types, *string_types), - 'supershipit': Any(list_string_types, *string_types), - 'support': Any("core", "network", "community"), - }) - ) - - list_dict_file_schema = [{str_type: files_schema} - for str_type in string_types] - - schema = Schema({ - Required('automerge'): bool, - Required('collection_redirect'): bool, - Required('notifications'): bool, - Required('files'): Any(None, *list_dict_file_schema), - Required('macros'): dict, # Any(*list_macros_schema), - }) - - # Ensure schema is valid - - try: - schema(botmeta) - except MultipleInvalid as ex: - for error in ex.errors: - # No way to get line numbers - print('%s:%d:%d: %s' % (path, 0, 0, humanize_error(botmeta, error))) - - # Ensure botmeta is always support:core - botmeta_support = botmeta.get('files', {}).get('.github/BOTMETA.yml', {}).get('support', '') - if botmeta_support != 'core': - print('%s:%d:%d: .github/BOTMETA.yml MUST be support: core' % (path, 0, 0)) - - # Find all path (none-team) macros so we can substitute them - macros = botmeta.get('macros', {}) - path_macros = [] - for macro in macros: - if macro.startswith('team_'): - continue - path_macros.append(macro) - - -if __name__ == '__main__': - main() - -# Possible future work -# * Schema for `macros:` - currently ignored due to team_ansible -# * Ensure that all $teams mention in `files:` exist in `$macros` -# * Validate GitHub names - possibly expensive lookup needed - No should be validated when module is added - gundalow diff --git a/test/sanity/code-smell/botmeta.requirements.in b/test/sanity/code-smell/botmeta.requirements.in deleted file mode 100644 index edd96991dde..00000000000 --- a/test/sanity/code-smell/botmeta.requirements.in +++ /dev/null @@ -1,2 +0,0 @@ -pyyaml -voluptuous diff --git a/test/sanity/code-smell/botmeta.requirements.txt b/test/sanity/code-smell/botmeta.requirements.txt deleted file mode 100644 index a1cd9ef5434..00000000000 --- a/test/sanity/code-smell/botmeta.requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -# edit "botmeta.requirements.in" and generate with: hacking/update-sanity-requirements.py --test botmeta -# pre-build requirement: pyyaml == 6.0 -# pre-build constraint: Cython < 3.0 -PyYAML==6.0 -voluptuous==0.13.1