[Midnightbsd-cvs] [MidnightBSD/mports] 0ddfa0: magus: add optional ZFS chroot rollback (#772)

Lucas Holt noreply at github.com
Sun Aug 23 09:57:42 EDT 2026


  Branch: refs/heads/master
  Home:   https://github.com/MidnightBSD/mports
  Commit: 0ddfa0aa839d1c05770d7dfb4c645f19cd92ab18
      https://github.com/MidnightBSD/mports/commit/0ddfa0aa839d1c05770d7dfb4c645f19cd92ab18
  Author: Lucas Holt <luke at foolishgames.com>
  Date:   2026-08-23 (Sun, 23 Aug 2026)

  Changed paths:
    M Tools/lib/Magus/App/Slave/Worker.pm
    M Tools/lib/Magus/Chroot.pm
    M Tools/lib/Magus/Config.pm
    M Tools/lib/Magus/PortTest.pm
    M Tools/magus/config.yaml.example
    M Tools/magus/slave/magus.pl
    A Tools/t/magus-chroot-zfs.t

  Log Message:
  -----------
  magus: add optional ZFS chroot rollback (#772)

## Summary
- add an opt-in per-worker ZFS chroot backend while retaining cpdup by
default
- rebuild each ZFS worker from the verified bootstrap and create a fresh
magus-clean snapshot at daemon startup
- roll dirty workers back between builds and mark them dirty before
dependency or distfile injection
- validate dataset names, mountpoints, local ownership, and unexpected
children before destructive ZFS operations

## Testing
- prove -I Tools/lib Tools/t/magus-chroot-zfs.t
- perl syntax checks for Magus::Chroot, Magus::PortTest, and the new
test
- parsed Tools/magus/config.yaml.example with YAML::LoadFile
- git diff --check

End-to-end ZFS, mount, chroot, and Magus build testing was not run
because the development host is not MidnightBSD.

## Summary by Sourcery

Add an optional ZFS chroot backend that provides verified per-worker
rollback baselines and safer lifecycle management while retaining
existing cpdup behavior by default.

New Features:
- Add an opt-in ZFS-backed chroot mode for Magus workers while
preserving cpdup as the default backend.
- Refresh per-worker ZFS chroot baselines from the verified bootstrap at
daemon startup and roll workers back to clean snapshots between builds.

Bug Fixes:
- Ensure chroots are marked dirty before dependency and distfile
injection so interrupted builds cannot leave modified state marked
clean.
- Detect replaced bootstrap tarballs reliably and refresh stale chroot
references when the bootstrap changes.

Enhancements:
- Validate ZFS dataset ownership, mountpoints, configuration, and child
contents before destructive operations.
- Standardize external command execution and strengthen mount cleanup
checks for chroot management.

Documentation:
- Document the new optional ZFS chroot configuration settings in the
example Magus configuration.

Tests:
- Add coverage for bootstrap checksum invalidation, ZFS configuration
validation, ownership and child safety checks, baseline refresh, and
rollback behavior.

---------

Signed-off-by: Lucas Holt <luke at foolishgames.com>



To unsubscribe from these emails, change your notification settings at https://github.com/MidnightBSD/mports/settings/notifications


More information about the Midnightbsd-cvs mailing list