diff options
| author | omnom62 <75066712+omnom62@users.noreply.github.com> | 2026-05-26 05:24:39 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-26 05:24:39 +1000 |
| commit | 9590233744f69f42ef5ed5dbf18ece36b3183bc0 (patch) | |
| tree | 3f40d5eaba6584420a8aba0cea167c38564701b7 | |
| parent | 2ae03b76e08c24115c27ae1a0f97d663d678102c (diff) | |
| parent | 70bb194f16ca719e7991ff2edb700240442b9de9 (diff) | |
| download | vyos.vyos-chore/test-changelog.tar.gz vyos.vyos-chore/test-changelog.zip | |
Merge branch 'main' into chore/test-changelogchore/test-changelog
| -rw-r--r-- | .coderabbit.yaml | 444 | ||||
| -rw-r--r-- | changelogs/fragments/t8851-coderabbit-centralized.yml | 6 |
2 files changed, 35 insertions, 415 deletions
diff --git a/.coderabbit.yaml b/.coderabbit.yaml index 38eae56f..c14e52eb 100644 --- a/.coderabbit.yaml +++ b/.coderabbit.yaml @@ -1,50 +1,35 @@ # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json -# CodeRabbit configuration for vyos/vyos.vyos Ansible network collection -# Docs: https://docs.coderabbit.ai/guides/configure-coderabbit - -language: en-US -early_access: false -tone_instructions: > - Concise, technical, no filler. Focus on correctness, security, idempotency, - and Ansible conventions. Cite file paths and line numbers. +# +# Per-repo CodeRabbit override for vyos/vyos.vyos (Ansible network collection). +# +# Most behavior is inherited from the org-level central baseline at +# https://github.com/vyos/coderabbit/blob/production/.coderabbit.yaml. +# This file keeps only what's distinct to this repo: +# - Ansible-collection-specific `path_instructions` (15 entries). +# - Two `path_filters` entries that aren't in the central list. +# - `base_branches: [main]` — central uses VyOS release-train names; this +# repo is an Ansible collection that lives on `main`. +# - `knowledge_base.jira` scoped to VD. +# +# Migrated from standalone (591-line rich config from T8584, sha +# 38eae56fb991b63e0c89245e4ef5fc130d3f5c8b) to centralized inheritance +# mode under T8851 on 2026-05-24. The standalone config preceded +# `vyos/coderabbit` central-config introduction (2026-05-12). + +inheritance: true reviews: - profile: chill - request_changes_workflow: false - high_level_summary: true - high_level_summary_placeholder: '@coderabbitai summary' - auto_title_placeholder: '@coderabbitai' - review_status: true - poem: false - collapse_walkthrough: true - changed_files_summary: true - sequence_diagrams: false - assess_linked_issues: true - related_issues: true - related_prs: true - suggested_labels: false - auto_apply_labels: false - suggested_reviewers: false - auto_review: - enabled: true - auto_incremental_review: true - drafts: false base_branches: - main - ignore_title_keywords: - - WIP - - DO NOT MERGE - - Bump path_filters: - - '!**/__pycache__/**' - - '!**/*.pyc' - - '!**/*.egg-info/**' + # Repo-specific filters that aren't in the central baseline. The + # central already filters `!**/__pycache__/**`, `!**/*.pyc`, + # `!**/*.egg-info/**`, `!**/.venv/**`, `!**/.worktrees/**` — so they + # are not repeated here. - '!changelogs/changelog.yaml' - - '!.venv/**' - '!.collections/**' - - '!.worktrees/**' path_instructions: # ── Global PR hygiene ────────────────────────────────────────────── @@ -209,383 +194,12 @@ reviews: not be un-tombstoned. requires_ansible must stay >=2.15.0 unless explicitly bumping minimum version. - finishing_touches: - docstrings: - enabled: true - unit_tests: - enabled: true - - tools: - github-checks: - enabled: true - timeout_ms: 90000 - eslint: - enabled: false - biome: - enabled: false - actionlint: - enabled: true - yamllint: - enabled: true - markdownlint: - enabled: true - languagetool: - enabled: true - level: default - enabled_only: false - gitleaks: - enabled: true - checkov: - enabled: false - semgrep: - enabled: true - ast-grep: - essential_rules: true - ruff: - enabled: false - -chat: - auto_reply: true knowledge_base: - opt_out: false - learnings: - scope: auto - issues: - scope: auto - pull_requests: - scope: auto - linked_repositories: - - repository: "ansible/ansible" - instructions: > - Core Ansible framework. Reference for module_utils base classes, - plugin interfaces (cliconf, terminal, action), module documentation - conventions (DOCUMENTATION/EXAMPLES/RETURN YAML blocks), and - ansible-test sanity requirements. - - repository: "ansible-collections/ansible.netcommon" - instructions: > - Network common collection. Contains ConfigBase, ResourceModule, - FactsBase, NetworkTemplate, and get_resource_connection — the base - classes and utilities that vyos.vyos modules directly extend. - -code_generation: - docstrings: - language: en-US - path_instructions: - # ── Module entry points: YAML blocks, not Python docstrings ────── - - path: 'plugins/modules/vyos_*.py' - instructions: | - Do NOT generate Python-style docstrings for these files. Ansible modules - use YAML triple-string blocks: DOCUMENTATION, EXAMPLES, and RETURN. - If updating these blocks: - - DOCUMENTATION must include: module name, author, short_description, - description (list of strings), version_added, extends_documentation_fragment - (vyos.vyos.vyos), and a full options tree with type, description, and - choices/default where applicable. Include a notes section listing supported - VyOS versions (1.3.8, 1.4.1, 1.4.2, 1.5 rolling). - - EXAMPLES must show at least one task per supported state using FQCN - (vyos.vyos.vyos_<module>). - - RETURN must document: commands (list, always), before (dict, always), - after (dict, when changed), and any module-specific return values. - Keep version_added accurate — do not backdate. - - # ── Argspec: skip auto-generated files ─────────────────────────── - - path: 'plugins/module_utils/network/vyos/argspec/**' - instructions: | - Skip — these files are auto-generated by the Ansible resource module builder - and carry a "DO NOT EDIT" header. Do not generate or modify docstrings. - - # ── Config classes ─────────────────────────────────────────────── - - path: 'plugins/module_utils/network/vyos/config/**' - instructions: | - Config builder classes extending ConfigBase or ResourceModule. Use - reStructuredText-style docstrings (Ansible/Sphinx convention): - def method(self, ...): - """Short description. - - :param name: description - :type name: type - :rtype: type - :returns: description - """ - Document: execute_module(), set_config(), get_<resource>_facts(), and any - method that generates CLI commands. Focus on what state transitions the - method handles and what CLI commands it may produce. Do not document trivial - __init__ that just calls super(). Some files have auto-generated headers — - keep docstrings minimal in those to avoid noise on regeneration. - - # ── Facts classes ──────────────────────────────────────────────── - - path: 'plugins/module_utils/network/vyos/facts/**' - instructions: | - Facts parsers that convert VyOS CLI output to structured dicts. Use rST - docstrings. Document: - - populate(): what show commands it runs and the dict structure it returns. - - render_config() / get_device_data(): the CLI command used and expected - output format. - - Any regex-heavy parsing method: briefly note what CLI patterns it handles. - Skip __init__.py files. - - # ── RM Templates ───────────────────────────────────────────────── - - path: 'plugins/module_utils/network/vyos/rm_templates/*.py' - instructions: | - Parser template files with _tmplt_* helper functions and PARSERS lists. - Add a module-level docstring describing the resource and VyOS CLI hierarchy - covered. For _tmplt_* functions: one-line docstring stating the VyOS command - path generated (e.g., "Generate `set protocols bgp <asn> neighbor <addr> - timers ...` commands."). Do not document individual regex PARSERS entries — - the patterns are self-describing. Files with _14 suffix target VyOS 1.4+ — - note this in the module docstring. - - # ── Cliconf plugin ────────────────────────────────────────────── - - path: 'plugins/cliconf/vyos.py' - instructions: | - Uses Ansible DOCUMENTATION block for plugin-level docs. For Python methods - use rST docstrings. Document: get_device_info(), edit_config(), get_config(), - get_diff(), commit(), discard_changes(). Note which methods enter/exit - configure mode. - - # ── Terminal and action plugins ────────────────────────────────── - - path: 'plugins/terminal/vyos.py' - instructions: | - Minimal docstrings only. Document on_open_shell() and on_close_shell() - explaining what terminal parameters they set. Regex patterns are - self-documenting — do not add inline comments to each pattern. - - - path: 'plugins/action/vyos.py' - instructions: | - Skip — thin proxy inheriting ActionNetworkModule. No docstrings needed. - - # ── Utilities ──────────────────────────────────────────────────── - - path: 'plugins/module_utils/network/vyos/utils/*.py' - instructions: | - Utility functions shared across modules. Use rST docstrings for any - function with non-obvious behavior. Document parameters, return types, - and side effects. Skip trivial one-liners. - - # ── Test files ────────────────────────────────────────────────── - - path: 'tests/**' - instructions: | - Skip — test files do not need docstrings. Test method names should be - self-describing (test_vyos_<module>_<state>_<scenario>). - - unit_tests: - path_instructions: - # ── Resource module tests ──────────────────────────────────────── - - path: 'plugins/modules/vyos_interfaces.py' - instructions: &resource_module_tests | - Generate tests in tests/unit/modules/network/vyos/test_vyos_<module>.py. - Inherit from TestVyosModule (import from vyos_module.py in same directory). - - Structure: - ```python - class TestVyos<Module>Module(TestVyosModule): - module = vyos_<module> - - def setUp(self): - super().setUp() - # Mock get_resource_connection at BOTH levels: - self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils." - "network.common.cfg.base.get_resource_connection" - ) - self.mock_get_resource_connection_facts = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils." - "network.common.facts.facts.get_resource_connection" - ) - # Mock the facts get_device_data method: - self.mock_execute_show_command = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network." - "vyos.facts.<resource>.<resource>.<FactsClass>.get_device_data" - ) - # Start all patches and store references - self.execute_show_command = self.mock_execute_show_command.start() - - def tearDown(self): - super().tearDown() - # Stop ALL patches - - def load_fixtures(self, commands=None, filename=None): - def load_from_file(*args, **kwargs): - return load_fixture(filename or "vyos_<module>_config.cfg") - self.execute_show_command.side_effect = load_from_file - ``` - - Required test methods for each resource module: - - test_vyos_<module>_merged: config change, changed=True, verify commands list - - test_vyos_<module>_merged_idempotent: no-op, changed=False, commands=[] - - test_vyos_<module>_replaced: replaced state, changed=True - - test_vyos_<module>_replaced_idempotent: replaced no-op, changed=False - - test_vyos_<module>_overridden: full override, changed=True - - test_vyos_<module>_deleted: deletion, changed=True - - test_vyos_<module>_gathered: state=gathered, verify result["gathered"] dict - - test_vyos_<module>_rendered: state=rendered, verify result["rendered"] commands - - test_vyos_<module>_parsed: state=parsed with running_config, verify output - - Assertions use self.execute_module(changed=True/False, commands=[...]). - Commands lists contain exact VyOS CLI strings: "set interfaces ethernet eth0 ...". - Use set_module_args(dict(config=[...], state="<state>")) before execute_module. - Create fixture files in tests/unit/modules/network/vyos/fixtures/ named - vyos_<module>_config.cfg with valid VyOS set-syntax configuration. - Use load_fixture() to read fixtures — never inline raw config. - - - path: 'plugins/modules/vyos_l3_interfaces.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_lag_interfaces.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_lldp_global.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_lldp_interfaces.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_static_routes.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_firewall_rules.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_firewall_global.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_firewall_interfaces.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_ospfv2.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_ospfv3.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_ospf_interfaces.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_bgp_global.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_bgp_address_family.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_prefix_lists.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_route_maps.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_snmp_server.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_logging_global.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_ntp_global.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_hostname.py' - instructions: *resource_module_tests - - - path: 'plugins/modules/vyos_vrf.py' - instructions: *resource_module_tests - - # ── Legacy module tests ────────────────────────────────────────── - - path: 'plugins/modules/vyos_command.py' - instructions: &legacy_module_tests | - Generate tests in tests/unit/modules/network/vyos/test_vyos_<module>.py. - Inherit from TestVyosModule. - - Legacy modules mock differently from resource modules: - ```python - class TestVyos<Module>Module(TestVyosModule): - module = vyos_<module> - - def setUp(self): - super().setUp() - # Mock run_commands directly on the module: - self.mock_run_commands = patch( - "ansible_collections.vyos.vyos.plugins.modules." - "vyos_<module>.run_commands" - ) - self.run_commands = self.mock_run_commands.start() - # Some also mock get_capabilities or get_config/load_config - - def tearDown(self): - super().tearDown() - self.mock_run_commands.stop() - - def load_fixtures(self, commands=None, filename=None): - # Set run_commands return_value or side_effect - self.run_commands.return_value = [load_fixture(filename)] - ``` - - Legacy modules (vyos_command, vyos_config, vyos_facts, vyos_banner, - vyos_ping, vyos_system, vyos_user, vyos_vlan) do not use - resource module states. Test: successful execution, error handling, - idempotency where applicable, and specific module features (e.g., - vyos_command wait_for/retries, vyos_config src/lines/match). - Use execute_module(changed=, commands=) for assertions. - - - path: 'plugins/modules/vyos_config.py' - instructions: *legacy_module_tests - - - path: 'plugins/modules/vyos_facts.py' - instructions: *legacy_module_tests - - - path: 'plugins/modules/vyos_banner.py' - instructions: *legacy_module_tests - - - path: 'plugins/modules/vyos_ping.py' - instructions: *legacy_module_tests - - - path: 'plugins/modules/vyos_system.py' - instructions: *legacy_module_tests - - - path: 'plugins/modules/vyos_user.py' - instructions: *legacy_module_tests - - - path: 'plugins/modules/vyos_vlan.py' - instructions: *legacy_module_tests - - # ── Test infrastructure — do not generate tests for these ──────── - - path: 'tests/unit/modules/utils.py' - instructions: | - Skip — test infrastructure (ModuleTestCase base, set_module_args, exception - classes). Do not generate tests for test utilities. - - - path: 'tests/unit/modules/conftest.py' - instructions: | - Skip — pytest fixtures (patch_ansible_module). Do not generate tests. - - - path: 'tests/unit/modules/network/vyos/vyos_module.py' - instructions: | - Skip — TestVyosModule base class with execute_module(), load_fixture(), - and mock setup. Do not generate tests for the test base class. - - - path: 'tests/unit/modules/network/vyos/fixtures/**' - instructions: | - Skip — raw VyOS CLI output fixtures. Not code, not testable. - - # ── Non-module plugin code ─────────────────────────────────────── - - path: 'plugins/module_utils/**' - instructions: | - Module utility code (argspec, config, facts, rm_templates, utils). - These are tested indirectly through module-level tests — the config - classes are exercised when test_vyos_<module>.py calls execute_module(). - Do not generate separate unit tests for module_utils classes unless - a utility function in plugins/module_utils/network/vyos/utils/ has - complex standalone logic worth testing in isolation. - - - path: 'plugins/cliconf/vyos.py' - instructions: | - Skip — cliconf plugin is tested via integration tests and indirectly - through module tests. Unit testing requires complex CliconfBase mocking - that provides little value over integration coverage. - - - path: 'plugins/terminal/vyos.py' - instructions: | - Skip — terminal plugin regex patterns are validated through integration - tests against actual VyOS devices. - - - path: 'plugins/action/vyos.py' - instructions: | - Skip — thin action proxy. Tested indirectly via module tests. + jira: + # `auto` activates Jira context lookups when this repo lives on an + # org with an Atlassian OAuth grant attached (VyOS-Networks); on the + # public vyos source it self-disables. + usage: auto + project_keys: + - VD diff --git a/changelogs/fragments/t8851-coderabbit-centralized.yml b/changelogs/fragments/t8851-coderabbit-centralized.yml new file mode 100644 index 00000000..b9be774e --- /dev/null +++ b/changelogs/fragments/t8851-coderabbit-centralized.yml @@ -0,0 +1,6 @@ +trivial: + - Migrate ``.coderabbit.yaml`` from standalone configuration to centralized + inheritance under the org-level baseline at ``vyos/coderabbit``. No effect + on consumers; the file shrinks from 591 lines to 205 while preserving all + Ansible-collection-specific ``path_instructions`` and adding a + ``knowledge_base.jira`` block scoped to ``VD`` (T8851). |
