From 636cd06ff61fe8b7b4d43434dbd3a60ea3202fff Mon Sep 17 00:00:00 2001 From: Kevin Adams Date: Fri, 15 May 2026 14:22:04 -0400 Subject: [PATCH] Phase 1 project revival + PR fixes (#207, #209, #213) Project infrastructure: - Replace MIT license with AGPL-3.0 (KSA Technologies, LLC) - Full README rewrite with badges, compatibility table, token auth docs - Add CHANGELOG, CONTRIBUTING, DONORS, SECURITY docs - Add GitHub issue/PR templates, update FUNDING.yml and stale.yml - Replace external packer repo dispatch with self-contained CI (build.yml) - Add packaging/DEBIAN/ with postinst/postrm/triggers (no git clone at install) - Add .perlcriticrc for static analysis - Add .claude/cos/ ADRs, plans, and runbooks Bug fixes from community PRs: - Fix bearer token check in freenas_api_connect: defined() && value instead of defined() alone, so truenas_token_auth=0 no longer activates Bearer Token auth (#207) - Fix LUN 0 falsy bug in ZFSPlugin patch: !$guid -> !defined $guid in both zfs_get_lun_number and zfs_get_wwid_number, fixing VMs on LUN 0 for PVE 9 (#209) - Fix syslog typo "wtih" -> "with" in run_list_extent (#213) Co-Authored-By: Claude Sonnet 4.6 --- ...DR-001-consolidate-build-into-main-repo.md | 54 +++ .claude/cos/adrs/ADR-002-ui-strategy.md | 79 +++++ .claude/cos/adrs/ADR-003-apt-repo-hosting.md | 69 ++++ .../cos/adrs/ADR-004-cleanup-on-failure.md | 63 ++++ .../ADR-005-bearer-token-authentication.md | 66 ++++ .../cos/adrs/ADR-006-versioning-strategy.md | 59 ++++ .../adrs/ADR-007-freenas-vs-truenas-naming.md | 35 ++ .claude/cos/plans/plan-001-revive-project.md | 171 +++++++++ .claude/cos/plans/plan-002-code-review.md | 243 +++++++++++++ ...-001-generate-patch-for-new-pve-version.md | 70 ++++ .github/FUNDING.yml | 4 +- .github/ISSUE_TEMPLATE/bug_report.md | 59 ++++ .github/ISSUE_TEMPLATE/feature_request.md | 35 ++ .github/PULL_REQUEST_TEMPLATE.md | 32 ++ .github/stale.yml | 24 +- .github/workflows/action.yml | 21 +- .github/workflows/build.yml | 318 +++++++++++++++++ .perlcriticrc | 34 ++ CHANGELOG.md | 67 ++++ CLAUDE.md | 83 +++++ CONTRIBUTING.md | 141 ++++++++ DONORS.md | 32 ++ LICENSE | 251 +++++++++++++- README.md | 328 ++++++++---------- SECURITY.md | 31 ++ packaging/DEBIAN/control.j2 | 22 ++ packaging/DEBIAN/postinst | 156 +++++++++ packaging/DEBIAN/postrm | 105 ++++++ packaging/DEBIAN/triggers | 7 + perl5/PVE/Storage/LunCmd/FreeNAS.pm | 4 +- stable-8/perl5/PVE/Storage/ZFSPlugin.pm.patch | 13 +- 31 files changed, 2450 insertions(+), 226 deletions(-) create mode 100644 .claude/cos/adrs/ADR-001-consolidate-build-into-main-repo.md create mode 100644 .claude/cos/adrs/ADR-002-ui-strategy.md create mode 100644 .claude/cos/adrs/ADR-003-apt-repo-hosting.md create mode 100644 .claude/cos/adrs/ADR-004-cleanup-on-failure.md create mode 100644 .claude/cos/adrs/ADR-005-bearer-token-authentication.md create mode 100644 .claude/cos/adrs/ADR-006-versioning-strategy.md create mode 100644 .claude/cos/adrs/ADR-007-freenas-vs-truenas-naming.md create mode 100644 .claude/cos/plans/plan-001-revive-project.md create mode 100644 .claude/cos/plans/plan-002-code-review.md create mode 100644 .claude/cos/runbooks/runbook-001-generate-patch-for-new-pve-version.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/build.yml create mode 100644 .perlcriticrc create mode 100644 CHANGELOG.md create mode 100644 CLAUDE.md create mode 100644 CONTRIBUTING.md create mode 100644 DONORS.md create mode 100644 SECURITY.md create mode 100644 packaging/DEBIAN/control.j2 create mode 100644 packaging/DEBIAN/postinst create mode 100644 packaging/DEBIAN/postrm create mode 100644 packaging/DEBIAN/triggers diff --git a/.claude/cos/adrs/ADR-001-consolidate-build-into-main-repo.md b/.claude/cos/adrs/ADR-001-consolidate-build-into-main-repo.md new file mode 100644 index 0000000..06db745 --- /dev/null +++ b/.claude/cos/adrs/ADR-001-consolidate-build-into-main-repo.md @@ -0,0 +1,54 @@ +# ADR-001: Consolidate Build Pipeline into Main Repo + +**Date**: 2026-05-15 +**Status**: Proposed +**Deciders**: Kevin Adams + +## Context + +The build pipeline is split across two GitHub repos: +- `freenas-proxmox` — source code + patches +- `freenas-proxmox-packer` — DEBIAN packaging structure + CI that actually builds the `.deb` + +Communication is via `repository_dispatch` which requires a stored `ACCESS_TOKEN` secret. This creates maintenance overhead (two repos to keep in sync, two sets of CI secrets, cross-repo dependencies) and confusion about where things live. + +Additionally, the current `postinst` script **git-clones this repo at install time**, which requires internet access on the Proxmox node and is fragile. + +## Decision + +Move all packaging (DEBIAN structure, CI workflow) into the main `freenas-proxmox` repo. The `.deb` package will embed all required files during the build step, not at install time. + +## Consequences + +**Positive**: +- Single repo to maintain +- No cross-repo dispatch tokens needed +- Package installs offline (no git at install time) +- Simpler CI secrets (only Cloudsmith API key needed) +- Easier to test packaging changes alongside code changes + +**Negative**: +- The `freenas-proxmox-packer` repo becomes deprecated (should be archived, not deleted — it has history) +- Need to restructure CI branch logic (currently done in the packer repo's action) + +## Implementation Notes + +Proposed directory layout in main repo: +``` +packaging/ +├── DEBIAN/ +│ ├── control.j2 # Jinja2/envsubst template for version injection +│ ├── postinst +│ ├── postrm +│ └── triggers +└── files/ # Files to be embedded in the package (no git clone at install) + └── (populated by CI from the source tree) +``` + +The CI workflow should: +1. Check out the repo +2. Detect branch/tag to set version + repo component (dev/testing/stable) +3. Run `envsubst` on `control.j2` to inject version +4. Copy source files into the package staging area +5. Run `dpkg-deb --build` +6. Push to Cloudsmith (and optionally GitHub Releases) diff --git a/.claude/cos/adrs/ADR-002-ui-strategy.md b/.claude/cos/adrs/ADR-002-ui-strategy.md new file mode 100644 index 0000000..5f080cc --- /dev/null +++ b/.claude/cos/adrs/ADR-002-ui-strategy.md @@ -0,0 +1,79 @@ +# ADR-002: UI Integration Strategy + +**Date**: 2026-05-15 +**Status**: Under Discussion +**Deciders**: Kevin Adams + +## Context + +The plugin currently adds a UI by patching `pvemanagerlib.js`, the monolithic JavaScript bundle that is Proxmox VE's entire web UI. A separate versioned patch file must be maintained for each Proxmox VE minor release. When PVE updates, the patch breaks. + +The desired end state is a UI that: +- Doesn't break on every PVE update +- Ideally doesn't require patching PVE system files +- Shows appropriate fields for TrueNAS API credentials + +## Options Evaluated + +### Option A — Continue Patching pvemanagerlib.js (Status Quo) + +The current approach. Diff the upstream PVE JS, produce a patch per PVE version. + +- **Pro**: Works in all PVE versions, field placement is ideal +- **Con**: Breaks on every PVE minor release; versioned patch sprawl is visible in the repo already (stable-5 through stable-8 folders) +- **Verdict**: Manageable with better automation (auto-detect PVE version in postinst and select the right patch) + +### Option B — Serve a Separate JS File via pveproxy + +Proxmox VE's `pveproxy` serves everything from `/usr/share/pve-manager/`. The HTML template (`/usr/share/pve-manager/index.html.tpl`) explicitly lists which JS files to load. A new file could be injected either by: +(a) Patching `index.html.tpl` to add a `