Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v7

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@1.99.1
with:
components: rustfmt, clippy
targets: x86_64-unknown-linux-musl
Expand All @@ -49,7 +49,7 @@ jobs:
- uses: actions/checkout@v7

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@1.99.1
with:
components: clippy

Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
- uses: actions/checkout@v7

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@1.99.1
with:
targets: ${{ matrix.target }}

Expand All @@ -130,7 +130,7 @@ jobs:
- uses: actions/checkout@v7

- name: Install Rust (musl target)
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@1.99.1
with:
targets: x86_64-unknown-linux-musl

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/e2e-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

# 用 runner 的 host 原生 gnu target 建置(免 musl C 交叉工具鏈)。
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@1.99.1

- name: Cache cargo
uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
- uses: actions/checkout@v7

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@1.99.1

- name: Cache cargo
uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:
- uses: actions/checkout@v7

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@1.99.1
with:
targets: ${{ matrix.guest_target }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
ref: ${{ needs.preflight.outputs.checkout_ref }}

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@1.99.1
with:
targets: ${{ matrix.target }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/checkout@v7

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@1.99.1

# 以預編二進位安裝 cargo-audit(免現場編譯,數秒完成)
- name: Install cargo-audit
Expand Down
11 changes: 8 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ CHEFER_LINUX_REF=v6.6.32 bash scripts/build-appliance.sh --arch x86_64 --out dis
CHEFER_LINUX_REF=v6.6.32 bash scripts/qemu-e2e.sh # Linux only: validates appliance + guest-agent in QEMU
cargo fmt
cargo clippy
powershell -File scripts/windows-wslc-e2e.ps1 # physical Windows: Dockerfile -> single exe -> WSL, no Docker
```

Testing: `cargo test` needs neither Docker nor WSL — integration tests (`crates/chefer-cli/tests/cli_e2e.rs`, `crates/chefer-pack/tests/pack_tests.rs`) synthesize minimal docker-archive/OCI image tars in-test and run init/check/build/inspect against the real CLI binary. A *full* manual E2E (real image → single-file exe → actually running it) additionally requires Docker (`docker save` an image) and, on a Windows host, WSL2. The macOS appliance path is validated on Linux with `scripts/qemu-e2e.sh`; the actual VZ boot path cannot be exercised on GitHub-hosted macOS runners and must be verified on a physical Mac (`scripts/vz-smoke.sh`). The **whp** backend is in the same position for the opposite reason — GitHub's windows runners have no nested virtualization, and the QEMU E2E uses virtio-console (hvc0) so it never exercises WHP's 8250 serial path — so run `scripts/whp-smoke.ps1` on a physical Windows machine with the Windows Hypervisor Platform enabled; it asserts exit-code propagation, **guest userspace stdout actually reaching the host**, TCP forwarding, and helper anti-orphan.
Testing: `cargo test` needs neither Docker nor WSL — integration tests (`crates/chefer-cli/tests/cli_e2e.rs`, `crates/chefer-pack/tests/pack_tests.rs`) synthesize minimal docker-archive/OCI image tars in-test and run init/check/build/inspect against the real CLI binary. A *full* manual E2E (real image → single-file exe → actually running it) additionally requires a real image and, on a Windows host, WSL2. `scripts/windows-wslc-e2e.ps1` builds a Dockerfile with WSL Containers (`wslc`), exports and packages the image, then verifies guest stdout and persisted output without Docker. Other manual tests may prepare their images with Docker (`docker save`). The macOS appliance path is validated on Linux with `scripts/qemu-e2e.sh`; the actual VZ boot path cannot be exercised on GitHub-hosted macOS runners and must be verified on a physical Mac (`scripts/vz-smoke.sh`). The **whp** backend is in the same position for the opposite reason — GitHub's windows runners have no nested virtualization, and the QEMU E2E uses virtio-console (hvc0) so it never exercises WHP's 8250 serial path — so run `scripts/whp-smoke.ps1` on a physical Windows machine with the Windows Hypervisor Platform enabled; it asserts exit-code propagation, **guest userspace stdout actually reaching the host**, TCP forwarding, and helper anti-orphan.

CI ([.github/workflows/ci.yml](.github/workflows/ci.yml)) builds and tests on Linux/Windows/macOS and verifies the musl guest-agent links statically. Linux E2E ([.github/workflows/e2e-linux.yml](.github/workflows/e2e-linux.yml)) covers native namespaces, the QEMU appliance path, and a boot smoke of the *cross-built* aarch64 appliance (`scripts/appliance-boot-smoke.sh` on an x86_64 runner — the same cross-build path release.yml uses, which the native-arm64 E2E job can't cover). Releases ([.github/workflows/release.yml](.github/workflows/release.yml)) build chefer-cli + chefer-runtime for 6 targets, guest-agent for both musl arches, and the Linux appliance for both guest arches — boot-smoking each appliance before upload — then attach one complete kit per host platform (CLI + all runtimes + both agents + appliance) to the GitHub Release.

Expand Down Expand Up @@ -58,13 +59,17 @@ Rule of thumb: the **release version** moves every release; the **spec/manifest/
**Authoring an `appcipe.yml`?** Read [skills/write-appcipe/SKILL.md](skills/write-appcipe/SKILL.md) — the full field reference, validation rules, and real-world gotchas (image `format` is hyphenated, official chown/gosu images (redis/postgres) run as-is on the root backends — WSL2 / macOS VM / native-Linux-as-root run services as real root with no user namespace — and on the native-Linux rootless path too when the host has `/etc/subuid` + `newuidmap` (rootless-Podman-style delegation; falls back to a single-uid map without them), the app-level `network:` field (default `bridge` = per-app netns isolation + outbound NAT; `internal` = no outbound; `shared` = old non-isolated behavior), `app_version` is display-only and not readable by the container). A runnable app+db example lives in [examples/demo/](examples/demo/).

See [examples/appcipe.yml](examples/appcipe.yml) for the fully-commented reference. Key semantics:
- `image:` accepts a short form or a full form (`source`/`file`/`format`/`platform`) — both map to `appcipe_spec::ImageSourceOrPath`. **`source: tar`** (local `docker save`/OCI archive) and **`source: image`** (registry pull at build time via `oci-client`, rustls; private registries via `docker login` plain `auths` or `CHEFER_REGISTRY_AUTH=user:pass` — credential helpers not supported, anonymous fallback for public images) are supported; `source: dockerfile` is rejected at validation. The short form auto-detects: a pinned registry ref (`redis:7.2-alpine`, has `:tag`/`@digest`, not a path/`.tar`/existing file — see `appcipe-normalize::looks_like_image_ref`) → `source: image`; otherwise a tar path. Registry refs **must** pin a non-`latest` tag or `@sha256` digest (`appcipe-spec` `check_image_reference`). The registry pull lives in `chefer-pack::registry` and produces the same `ResolvedImage` as a local tar, so the repack/diff_id path is shared.
- `image:` accepts a short form or a full form (`source`/`file`/`format`/`platform`) — both map to `appcipe_spec::ImageSourceOrPath`. **`source: tar`** (local `docker save`/OCI archive) and **`source: image`** (registry pull at build time via `oci-client`, rustls; private registries via `docker login` plain `auths` or `CHEFER_REGISTRY_AUTH=user:pass` — credential helpers not supported, anonymous fallback for public images) are supported; `source: dockerfile` builds with a host builder (docker/podman/nerdctl/Apple container; Windows also supports WSL Containers `wslc`). Set `CHEFER_DOCKERFILE_BUILDER=wslc` on Windows to select it explicitly. The short form auto-detects: a pinned registry ref (`redis:7.2-alpine`, has `:tag`/`@digest`, not a path/`.tar`/existing file — see `appcipe-normalize::looks_like_image_ref`) → `source: image`; otherwise a tar path. Registry refs **must** pin a non-`latest` tag or `@sha256` digest (`appcipe-spec` `check_image_reference`). The registry pull lives in `chefer-pack::registry` and produces the same `ResolvedImage` as a local tar, so the repack/diff_id path is shared.
- Persistence is opt-in per service via `persist_path`; data lands in `{data_dir or system default}/data/{service}/`. `old_names` drives automatic data-dir migration.
- `crash: fail_fast` (the only policy; legacy field name `crash_policy` accepted via serde alias): any service exiting non-zero terminates the whole app with that exit code. Additionally, an **interface service** (`interface_mode` gui/terminal/both) exiting *even with code 0* tears the whole app down (closing the window/terminal = app done) — otherwise background services like a `db` would linger after the GUI closes; a `none` service exiting 0 is treated as a finished background/one-shot task and the rest keep running.
- `interface_mode`: terminal | gui | both | none — at most one terminal/both service per app; host ports must be unique app-wide.

Validation rules live in `crates/appcipe-spec/src/validate.rs`; it collects **all** errors in one report (deterministic order).

## Delivery

After verification and review, commit and push authorized project changes without asking for push confirmation again.

## Follow-ups

(目前無。)
- 維護風險:`serde_yaml` 依賴的 `unsafe-libyaml 0.2.11` 已停止維護([RUSTSEC-2024-0449](https://rustsec.org/advisories/RUSTSEC-2024-0449))。目前沒有可升級的修補版本;後續評估替換 YAML parser,並驗證 AppCipe 解析與錯誤訊息相容性。
Loading
Loading