Commit graph

6 commits

Author SHA1 Message Date
Till Wegmueller
0510c8f31f Fix 8 bugs: include merging, UID collision, shell injection, OCI compliance
- spec-parser: merge_include now merges repos, variants, certs, incorporation
- forge-engine: auto-increment UID/GID from existing passwd/group files
- forge-engine: replace shell-based APT source addition with direct file write
- forge-engine/forge-oci: OS field is now distro-aware (solaris vs linux)
- forge-engine: apply owner/group via lchown on file/dir/symlink overlays
- forge-oci: diff_ids now use uncompressed tar digests per OCI image spec
- forge-oci: track real uncompressed_size instead of hardcoded 0
- forge-engine/forge-builder: use spec metadata version instead of "latest"
2026-04-09 22:45:42 +02:00
Till Wegmueller
d24dcc0363
Fix builder VM disk sizing, rootfs copy, and diagnostics
- Add disk_gb field to BuilderNode/BuilderConfig with 20GB default,
  fixing debootstrap failure caused by 2GB cloud image running out of
  space. Cloud-init growpart/resize_rootfs expand the partition.

- Replace walkdir-based copy_rootfs with cp -a to preserve symlinks,
  fixing grub-install failure caused by broken merged-/usr symlinks
  (/lib, /bin, /sbin -> /usr/*) in modern Ubuntu.

- Add network verification step that checks DNS before building and
  auto-fixes resolv.conf with SLIRP DNS (10.0.2.3) if needed.

- Add diagnostic collection on failure (debootstrap log, resolv.conf,
  disk space) before VM teardown.

- Include build stderr/stdout in RemoteBuildFailed error for better
  error reporting.

- Install build dependencies (debootstrap, qemu-utils, etc.) inside
  the builder VM before running the build.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 18:01:49 +01:00
Till Wegmueller
19c8379fc6
Add builder VM support for cross-platform and unprivileged builds
Introduce the forge-builder crate that automatically delegates builds to
an ephemeral VM when the host can't build locally (e.g., QCOW2 targets
without root, or OmniOS images on Linux). The builder detects these
conditions, spins up a VM via vm-manager with user-mode networking,
uploads inputs, streams the remote build output, and retrieves artifacts.

Key changes:
- New forge-builder crate with detection, binary resolution, VM lifecycle
  management, file transfer, and miette diagnostic errors
- BuilderNode added to spec-parser schema for per-spec VM config
- --local and --use-builder CLI flags on the build command
- Feature-gated (default on) integration in forger CLI
- Fix ext4 QCOW2 grub-install failure by using absolute paths in chroot
- Improve debootstrap to pass --components and write full sources.list

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 17:17:30 +01:00
Till Wegmueller
3cb982d35c
Add Ubuntu/apt support, ext4 QCOW2 builds, and OCI artifact push
- Extend spec-parser schema with distro, AptMirror, filesystem, and
  push-to fields for Ubuntu image support
- Add debootstrap/apt tool wrappers and Phase 1 distro dispatch
  (OmniOS IPS vs Ubuntu apt)
- Add ext4+GPT+EFI QCOW2 build path alongside existing ZFS pipeline
- Add partition tools (sgdisk, mkfs) and loopback partprobe support
- Add ORAS-compatible OCI artifact push/pull for QCOW2 files with
  custom media types (vnd.cloudnebula.qcow2)
- Add --artifact flag to forger push command
- Add auto-push from Phase 2 when target has push-to set
- Add omnios-rust-ci and ubuntu-rust-ci KDL image specs
- Update inspect command to display new fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 16:29:12 +01:00
Till Wegmueller
4290439e00
Add comprehensive tests and fix compiler warnings
- Fix false-positive unused_assignments warnings from thiserror/miette
  derive macros in Rust 2024 edition with crate-level #![allow]
- Add 5 tests for tar_layer (empty dir, files, nested dirs, symlinks,
  deterministic digest)
- Add 5 tests for manifest (default options, entrypoint/env, multiple
  layers, config digest verification, no entrypoint)
- Add 6 tests for layout (structure creation, oci-layout content,
  index.json references, layer blobs, config digest, multiple layers)
- Add 11 tests for overlays (file copy, empty file, missing source,
  ensure dir, symlink, remove file, remove dir contents, shadow
  create/update, multiple overlays)
- Add 4 tests for customizations (single user, multiple users, append
  to existing, no users noop)
- Add 3 tests for phase2/oci (layout output, entrypoint/env, empty
  staging)
- Add tempfile dev-dependency to forge-oci for test support

42 tests passing, 0 warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 15:40:16 +01:00
Till Wegmueller
48f8db1236
Initial implementation of refraction-forger
Standalone workspace with 4 crates for building optimized OS images
and publishing to OCI registries:

- spec-parser: KDL image spec parsing with include resolution and
  profile-based conditional filtering
- forge-oci: OCI image creation (tar layers, manifests, Image Layout)
  and registry push via oci-client
- forge-engine: Build pipeline with Phase 1 (rootfs assembly via native
  package managers with -R) and Phase 2 (QCOW2/OCI/artifact targets),
  plus dyn-compatible ToolRunner trait for external tool execution
- forger: CLI binary with build, validate, inspect, push, and targets
  commands

Ported KDL specs and overlay files from the vm-manager prototype.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 15:30:22 +01:00