Skip to content

Commit e5f4577

Browse files
JAORMXclaude
andcommitted
refactor: make embedded runtime the default build target
Align with brood-box: `task build` now produces a self-contained binary with embedded propolis runtime. Drop the separate plain-Go build target. `build-dev` / `build-dev-darwin` become aliases for `build`. Fix PROPOLIS_VERSION variable to use awk instead of go template syntax that conflicts with Taskfile delimiters. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0310378 commit e5f4577

2 files changed

Lines changed: 9 additions & 29 deletions

File tree

CLAUDE.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ MCP server for isolated code execution via propolis microVMs. Go + mcp-go, Strea
55
## Commands
66

77
```bash
8-
task build # Build binary (CGO_ENABLED=0)
9-
task build-dev # Build self-contained binary with embedded propolis runtime
8+
task build # Build self-contained binary with embedded propolis runtime
109
task test # go test -v -race ./...
1110
task lint # golangci-lint run ./...
1211
task verify # fmt + lint + test (CI gate)
@@ -28,7 +27,7 @@ Run a single test: `go test -v -race -run TestName ./pkg/path/to/package`
2827

2928
## Things That Will Bite You
3029

31-
- **propolis is a tagged dependency (v0.0.15)**: Fetched via normal Go module resolution. `build-dev` embeds propolis-runner, libkrun, and libkrunfw into the binary (downloaded via `task fetch-runtime`/`task fetch-firmware`, verified with sha256sums). Use `build-dev-system` for the old libkrun-devel path.
30+
- **propolis is a tagged dependency (v0.0.15)**: `task build` embeds propolis-runner, libkrun, and libkrunfw into the binary (downloaded via `task fetch-runtime`/`task fetch-firmware`, verified with sha256sums). Use `build-dev-system` for the system libkrun-devel path.
3231
- **Image cache and log level**: `WAGGLE_IMAGE_CACHE_DIR` (default `~/.cache/waggle/images/`) enables shared OCI image cache with layer-level caching and COW rootfs cloning. `WAGGLE_IMAGE_CACHE_MAX_AGE` (default `168h`/7d) controls eviction. `WAGGLE_LOG_LEVEL` (0-5, default 0) sets libkrun verbosity; levels > 3 leak hypervisor internals.
3332
- **Layered images**: Runtime images (python/node/shell) inherit from `images/base/` via `ARG BASE_IMAGE`. Build base first: `task build-image-base`. All runtime image tasks depend on it automatically.
3433
- **MCP error handling has two paths**: Return `mcp.NewToolResultError("msg"), nil` for user-facing errors (bad input, not found). Return `nil, err` only for internal server failures. Mixing these up breaks the MCP protocol.

Taskfile.yaml

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ vars:
1717
BUILD_DATE:
1818
sh: date -u +"%Y-%m-%dT%H:%M:%SZ"
1919
PROPOLIS_VERSION:
20-
sh: go list -m -f '{{.Version}}' github.com/stacklok/propolis
20+
sh: go list -m github.com/stacklok/propolis | awk '{print $2}'
2121
HOST_ARCH:
2222
sh: uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/'
2323
HOST_OS:
@@ -35,8 +35,7 @@ vars:
3535
-X github.com/stacklok/waggle/pkg/infra/vm/runtimebin.Version={{.PROPOLIS_VERSION}}
3636
3737
# Quick reference:
38-
# task build → Build waggle binary (pure Go, no CGO)
39-
# task build-dev → Build self-contained waggle with embedded propolis runtime
38+
# task build → Build self-contained waggle with embedded propolis runtime
4039
# task build-dev-system → Build waggle + propolis-runner from system libkrun
4140
# task fetch-runtime → Download pre-built propolis runtime from GitHub Release
4241
# task fetch-firmware → Download pre-built propolis firmware from GitHub Release
@@ -51,38 +50,20 @@ tasks:
5150
- task --list
5251

5352
build:
54-
desc: Build the waggle binary
55-
deps: [build-init]
53+
desc: Build self-contained waggle with embedded propolis runtime
54+
deps: [build-init, fetch-runtime, fetch-firmware]
55+
env:
56+
CGO_ENABLED: "0"
5657
cmds:
5758
- mkdir -p {{.BUILD_DIR}}
58-
- CGO_ENABLED=0 go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.MAIN_PACKAGE}}
59+
- go build -tags embed_runtime -ldflags "{{.LDFLAGS_EMBED}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.MAIN_PACKAGE}}
5960
sources:
6061
- ./**/*.go
6162
- go.mod
6263
- go.sum
6364
generates:
6465
- '{{.BUILD_DIR}}/{{.BINARY_NAME}}'
6566

66-
build-dev:
67-
desc: Build self-contained waggle with embedded propolis runtime
68-
platforms: [linux]
69-
deps: [build-init, fetch-runtime, fetch-firmware]
70-
env:
71-
CGO_ENABLED: "0"
72-
cmds:
73-
- mkdir -p {{.BUILD_DIR}}
74-
- go build -tags embed_runtime -ldflags "{{.LDFLAGS_EMBED}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.MAIN_PACKAGE}}
75-
76-
build-dev-darwin:
77-
desc: Build self-contained waggle with embedded propolis runtime (macOS)
78-
platforms: [darwin]
79-
deps: [build-init, fetch-runtime, fetch-firmware]
80-
env:
81-
CGO_ENABLED: "0"
82-
cmds:
83-
- mkdir -p {{.BUILD_DIR}}
84-
- go build -tags embed_runtime -ldflags "{{.LDFLAGS_EMBED}}" -o {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.MAIN_PACKAGE}}
85-
8667
build-dev-system:
8768
desc: Build waggle + propolis-runner from system libkrun (requires libkrun-devel)
8869
platforms: [linux]

0 commit comments

Comments
 (0)