|
| 1 | +### **ADR-009: Proposal to Adopt a Modernized Automation Toolchain** |
| 2 | + |
| 3 | +- **Status:** Proposed for Review |
| 4 | +- **Date:** 2025-07-09 |
| 5 | +- **Proposer:** Cameron |
| 6 | +- **Reviewers:** [List of project maintainers/core contributors] |
| 7 | + |
| 8 | +#### **1. Context and Problem Statement** |
| 9 | + |
| 10 | +The project's current automation toolchain, based on `Makefile` and POSIX-compliant shell |
| 11 | +scripts, has provided a simple and conventional interface for developers. It is pragmatic and |
| 12 | +effective for its stated purpose. |
| 13 | + |
| 14 | +However, as we formally adopt the Twelve-Factor App methodology for the application itself, an |
| 15 | +analysis of our automation tooling reveals a philosophical misalignment. Specifically, the |
| 16 | +current tooling does not fully adhere to the principles it helps enforce: |
| 17 | + |
| 18 | +1. **Implicit Dependencies (Violation of Factor II):** The toolchain implicitly relies on the |
| 19 | + existence and version of system-wide tools like `make`, `awk`, `grep`, and `curl`. Their |
| 20 | + presence is not explicitly declared or verified in a manifest, leading to a non-deterministic |
| 21 | + setup environment. |
| 22 | +2. **Blurred Build/Run Stages (Violation of Factor V):** Running a command like `make apply` |
| 23 | + mixes infrastructure planning, building, and execution. There is no distinct "build" or |
| 24 | + "setup" stage for the automation logic that validates its own dependencies before running. |
| 25 | +3. **Brittle Logic:** The current shell scripts rely on parsing the text output of command-line |
| 26 | + tools (e.g., `virsh domifaddr | awk ...`). This creates a fragile contract that is less |
| 27 | + stable across OS versions than using a formal, versioned API. |
| 28 | + |
| 29 | +This proposal seeks to address these shortcomings by evolving our automation toolchain to be a |
| 30 | +first-class, Twelve-Factor-compliant component of the project, thereby increasing its long-term |
| 31 | +robustness and maintainability. |
| 32 | + |
| 33 | +#### **2. Proposed Change** |
| 34 | + |
| 35 | +It is proposed that the project adopt a new technology stack for its automation, based on the |
| 36 | +following core decisions: |
| 37 | + |
| 38 | +1. **Adopt Meson as the Unified Automation Interface:** Meson will serve as the primary |
| 39 | + user-facing tool for running all project tasks. It will provide a single, declarative entry |
| 40 | + point for developers and CI/CD systems. |
| 41 | +2. **Adopt Modern Perl for Core Automation Logic:** The imperative logic currently in shell |
| 42 | + scripts will be migrated to a new, structured Perl codebase. |
| 43 | +3. **Adopt a "System-Package-Only" Dependency Policy:** To ensure maximum stability and a |
| 44 | + simple, curated "supply chain," this proposal mandates that all Perl module dependencies be |
| 45 | + fulfilled **exclusively through the system's native package manager** (e.g., `apt install |
| 46 | + libsys-virt-perl`). The direct use of language-specific, uncurated package managers like |
| 47 | + `cpanm` will be explicitly disallowed in the project's setup and CI workflows. |
| 48 | +4. **Establish a Stable Target Platform Benchmark:** All tooling and dependencies will target |
| 49 | + versions that are officially maintained for the **current Debian Stable release**. This |
| 50 | + includes packages from the official `backports` repository, as they are specifically compiled |
| 51 | + and certified for use with the stable base system. The critical guiding principle is: _Is the |
| 52 | + package officially provided for Debian Stable by the Debian maintainers?_ |
| 53 | + - _As of this writing, this sets our target versions to **Perl `5.36.0`** (from `bookworm`) |
| 54 | + and **Meson `1.7.0`** (from `bookworm-backports`)._ |
| 55 | + |
| 56 | +#### **3. Rationale for Proposed Change** |
| 57 | + |
| 58 | +This strategic evolution will bring our automation toolchain into stronger alignment with the |
| 59 | +Twelve-Factor methodology and yield significant long-term benefits: |
| 60 | + |
| 61 | +- **Explicit, Verifiable Dependencies (Factor II):** The `meson.build` file will serve as an |
| 62 | + explicit dependency manifest. It will programmatically check for `perl`, `opentofu`, |
| 63 | + `libvirt-client`, and all required `perl-*` packages. This provides a single, deterministic |
| 64 | + command (`meson setup`) to validate a contributor's environment, failing hard and early with |
| 65 | + clear error messages if the environment is incorrect. |
| 66 | +- **Clear Build/Run Separation (Factor V):** The Meson workflow naturally separates our |
| 67 | + processes. `meson setup` becomes our distinct "build" stage, which configures the project and |
| 68 | + validates all dependencies. `meson test` or `meson compile` becomes the "run" stage, |
| 69 | + executing tasks in a pre-validated environment. |
| 70 | +- **Increased Robustness and Maintainability:** Migrating from brittle text-parsing in shell to |
| 71 | + using formal Perl modules (like `Sys::Virt`) allows us to depend on more stable, versioned |
| 72 | + APIs. Perl also provides superior error handling, data structures, and code organization, |
| 73 | + which will make the automation easier to maintain and extend. |
| 74 | + |
| 75 | +#### **4. Scope and Relationship to Other Proposals** |
| 76 | + |
| 77 | +This document's scope is strictly limited to the **strategic decision to adopt Meson and |
| 78 | +Perl**. It establishes the core "why" and "what" of the change. |
| 79 | + |
| 80 | +All further details are explicitly deferred to subsequent proposals, which will build upon this |
| 81 | +foundational decision: |
| 82 | + |
| 83 | +- **Implementation Strategy & Structure (`ADR-005`):** Will detail the "how" of this migration, |
| 84 | + including the specific repository structure, the plan for an atomic cutover (a "flag day" |
| 85 | + migration), and the deprecation of the `Makefile`. |
| 86 | +- **Coding & Quality Standards (`ADR-006` and `ADR-007`):** Will define the "rules of the road" |
| 87 | + for the new Perl and Meson codebase, including mandatory pragmas, security hardening, linting |
| 88 | + policies, and style conventions. |
| 89 | + |
| 90 | +#### **5. Consequences and Acknowledged Trade-offs** |
| 91 | + |
| 92 | +- **Primary Benefit:** The project's automation tooling will become a more reliable, |
| 93 | + maintainable, and professionally engineered component, in full alignment with the principles |
| 94 | + it helps to deploy. |
| 95 | +- **Acknowledged Trade-off 1: Loss of "Zero-Prerequisite" Setup.** The single greatest |
| 96 | + trade-off is sacrificing the convenience of `make` being pre-installed. A contributor's first |
| 97 | + action will now be to install the Meson/Perl toolchain via their system package manager. This |
| 98 | + is a conscious decision to prioritize explicit, verifiable correctness over "zero-setup" |
| 99 | + convenience. |
| 100 | +- **Acknowledged Trade-off 2: Dependency on a Curated Ecosystem.** By committing to system |
| 101 | + packages benchmarked against Debian Stable (including its official backports), we gain |
| 102 | + stability at the cost of immediate access to bleeding-edge tool and library features. This is |
| 103 | + a deliberate choice to favor long-term stability and reliability. |
| 104 | + |
| 105 | +#### **6. Next Steps** |
| 106 | + |
| 107 | +If this strategic proposal is accepted, the maintainers will proceed with a formal review of |
| 108 | +`ADR-005`, `ADR-006`, and `ADR-007` to finalize the implementation plan and quality standards |
| 109 | +for the new toolchain. |
0 commit comments