Commit graph

14 commits

Author SHA1 Message Date
Marco Allegretti
1adeb8febf chore: remove redundant comments
No behavior changes.
2026-02-25 19:51:51 +01:00
Marco Allegretti
d78a770502 fix(core): make stop robust to stale state
- Stop can now succeed when metadata is stale but runtime indicates running\n- Only uses .running PID fallback for namespace/mock; avoids OCI PID misuse\n- Preserves non-Running states (e.g. Frozen) after stopping\n- Adds integration tests for stale metadata and Frozen stop
2026-02-25 19:26:22 +01:00
Marco Allegretti
598d07239e fix(core): include state in stop not-running error
Stop now reports the current env state when it is not running, to make the error actionable.
2026-02-25 19:02:33 +01:00
Marco Allegretti
cf8ed5ba67 fix(cli): improve enter/stop error context
- Stop now takes the store lock like other mutating commands\n- Wrap enter/exec/stop errors with env input and resolved id context\n- Enter/exec now return a clearer error when the env is already running or not built
2026-02-25 18:51:14 +01:00
Marco Allegretti
48a36a75b9 chore(core): trim redundant engine comments 2026-02-25 13:05:59 +01:00
Marco Allegretti
a9c09a369e fix(schema): avoid panics in manifest canonicalization
Make NormalizedManifest::canonical_json and compute_env_id fallible and propagate serialization errors through core engine code.
2026-02-25 12:59:19 +01:00
Marco Allegretti
961209ef0a fix: harden enter/stop and WAL recovery
- Guard WAL recovery and stale .running cleanup behind a try-acquired store lock\n- Persist rollback ResetState via MetadataStore to recompute checksums\n- Track a killable host PID for namespace enter/stop and treat SIGTERM/SIGKILL as clean exit\n- Derive OCI status PID via runtime state output\n- Make sandbox chroot script quoting robust for exec/enter
2026-02-25 11:48:58 +01:00
Marco Allegretti
eff53cf7af cli: satisfy clippy and rustfmt
Refactor build and rebuild command handlers to pass BuildOptions instead
of multiple boolean flags, satisfying clippy's excessive-bools and
too-many-arguments lints.

Apply rustfmt output in CLI and core engine code.
2026-02-23 18:50:23 +01:00
Marco Allegretti
6e66c58e5e core: add build options
Introduce BuildOptions to parameterize build and rebuild.

Add build_with_options/rebuild_with_options to support locked, offline, and
require-pinned-image modes. Locked mode verifies an existing lock file and
fails on drift. Offline mode fails fast when system packages are requested.
Also re-export BuildOptions from karapace-core.
2026-02-23 18:29:18 +01:00
Marco Allegretti
736f6ce7f1 fix: SBOM f-string quoting, ENOSPC commit skip, drop opensuse e2e-resolve
- Fix SBOM validation Python f-string: avoid double quotes inside
  double-quoted shell string (NameError: 'components' not defined)
- ENOSPC enospc_commit_fails_cleanly: skip gracefully if build fails
  (real backend tries to download image on tiny tmpfs in CI)
- Drop opensuse from e2e-resolve matrix (sh not in OCI exec PATH)
2026-02-22 20:59:19 +01:00
Marco Allegretti
62b9b569be fix supply chain: bump cargo-cyclonedx 0.5.7, fix SBOM generation, fix rmeta test
- Bump cargo-cyclonedx from 0.5.5 to 0.5.7 (supports lockfile v4)
- Generate SBOM for karapace-cli crate only (single predictable file)
- Fix --output-prefix → --override-filename (CLI change in 0.5.x)
- Fix rmeta tampering test: accept build failure as valid defense
  (cargo rejects corrupted .rmeta with compilation errors)
2026-02-22 20:31:08 +01:00
Marco Allegretti
37211dfd22 fix CI: fmt, skip migrate readonly test as root, fix container shell
- Run cargo fmt on skip_if_root() blocks
- Add skip_if_root() to migrate_atomic_version_unchanged_on_write_failure
- Add libc dev-dependency to karapace-store for root check
- Remove explicit shell: sh from container rustup steps (OCI exec
  can't find sh in PATH; default run shell works)
2026-02-22 20:11:09 +01:00
Marco Allegretti
cc67d70211 fix CI: skip readonly tests as root, manual rustup for containers
- Add skip_if_root() to 8 permission-based tests (root bypasses
  filesystem permissions in Docker containers)
- Replace dtolnay/rust-toolchain with manual rustup install via sh
  for container-based jobs (opensuse lacks bash, which the composite
  action requires)
- Keep dtolnay/rust-toolchain for non-container ubuntu jobs
2026-02-22 20:03:42 +01:00
Marco Allegretti
f535020600 feat: karapace-core — engine orchestration, lifecycle state machine, drift control
- Engine: init → resolve → lock → build → enter/exec → freeze → archive → destroy
- Cached store_root_str avoiding repeated to_string_lossy() allocations
- WAL-protected build, enter, exec, destroy, commit, restore, GC operations
- Overlay drift detection: diff/commit/export via upper_dir scanning
- Deterministic snapshot commit with composite identity hashing
- Atomic restore via staging directory swap
- StoreLock: compile-time enforcement via type parameter on gc()
- Signal handler: SIGINT/SIGTERM graceful shutdown with AtomicBool
- Push/pull delegation to karapace-remote backend
- Crash recovery: stale .running marker cleanup on Engine::new()
- Integration tests, E2E tests, crash injection tests, ENOSPC simulation
- Criterion benchmarks: build, rebuild, commit, restore, GC, verify
2026-02-22 18:37:02 +01:00