Skip to content

Commit b4cc31d

Browse files
JAORMXclaude
andcommitted
feat: upgrade propolis to v0.0.5 and wire extract.Source support
Switch from local `replace ../propolis` to tagged v0.0.5 module, removing sibling checkout requirements from CI and build-dev task. Add RuntimeSource/FirmwareSource fields to CreateVMOpts for embedded runtime distribution via propolis extract.Source API. Fix lint workflow by adding build-init step for go:embed, and resolve pre-existing gosec warnings (G703, G706). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 574894d commit b4cc31d

13 files changed

Lines changed: 56 additions & 31 deletions

File tree

.github/workflows/build.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ jobs:
1717
- name: Checkout code
1818
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
1919

20-
- name: Checkout propolis (sibling dependency)
21-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
22-
with:
23-
repository: stacklok/propolis
24-
ref: 6a81046b0472c54c877b965c34c97c094f373d74 # v0.1.0
25-
path: ../propolis
26-
2720
- name: Set up Go
2821
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
2922
with:

.github/workflows/lint.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,21 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
1818

19-
- name: Checkout propolis (sibling dependency)
20-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
21-
with:
22-
repository: stacklok/propolis
23-
ref: 6a81046b0472c54c877b965c34c97c094f373d74 # v0.1.0
24-
path: ../propolis
25-
2619
- name: Set up Go
2720
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
2821
with:
2922
go-version-file: 'go.mod'
3023
cache: true
3124

25+
- name: Install Task
26+
uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2
27+
with:
28+
version: '3.x'
29+
repo-token: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Build waggle-init (for go:embed)
32+
run: task build-init
33+
3234
- name: Lint
3335
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
3436
with:

.github/workflows/test.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
1818

19-
- name: Checkout propolis (sibling dependency)
20-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
21-
with:
22-
repository: stacklok/propolis
23-
ref: 6a81046b0472c54c877b965c34c97c094f373d74 # v0.1.0
24-
path: ../propolis
25-
2619
- name: Set up Go
2720
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
2821
with:

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Run a single test: `go test -v -race -run TestName ./pkg/path/to/package`
2727

2828
## Things That Will Bite You
2929

30-
- **propolis is a local replace**: `go.mod` uses `replace github.com/stacklok/propolis => ../propolis`. The propolis repo must be checked out as a sibling directory.
30+
- **propolis is a tagged dependency (v0.0.5)**: Fetched via normal Go module resolution. `build-dev` builds propolis-runner from the module cache (requires `libkrun-devel`). The `extract.Source` API is available for embedded runtime distribution.
3131
- **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.
3232
- **Code execution uses temp files, not `-c`**: Multi-line code is written to `/tmp/waggle_<uuid>.<ext>` in the VM via heredoc, executed, then cleaned up. Using `python3 -c` or `node -e` breaks on complex code.
3333
- **Shell escaping is mandatory**: Always use `propolis/ssh.ShellEscape()` for any user-provided string passed to SSH commands. Missing this is a command injection vulnerability.

Taskfile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ tasks:
5353
cmds:
5454
- task: build
5555
- mkdir -p {{.BUILD_DIR}}
56-
- cd ../propolis && CGO_ENABLED=1 go build -o "$OLDPWD/{{.BUILD_DIR}}/propolis-runner" ./runner/cmd/propolis-runner
56+
- CGO_ENABLED=1 go build -o {{.BUILD_DIR}}/propolis-runner github.com/stacklok/propolis/runner/cmd/propolis-runner
5757

5858
build-init:
5959
desc: Build the waggle-init binary (guest VM init)

cmd/waggle/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func configureLogger(logFile string) (func() error, error) {
182182
return func() error { return nil }, nil
183183
}
184184

185-
// #nosec G304 -- log file path is user-provided by design.
185+
// #nosec G304 G703 -- log file path is operator-configured, not external input.
186186
f, err := os.OpenFile(logFile, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o600)
187187
if err != nil {
188188
return nil, fmt.Errorf("open log file %s: %w", logFile, err)

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ go 1.25.7
88
require (
99
github.com/google/uuid v1.6.0
1010
github.com/mark3labs/mcp-go v0.44.0
11-
github.com/stacklok/propolis v0.0.0
11+
github.com/stacklok/propolis v0.0.5
1212
)
1313

1414
require (
@@ -75,5 +75,3 @@ require (
7575
gopkg.in/yaml.v3 v3.0.1 // indirect
7676
gvisor.dev/gvisor v0.0.0-20240916094835-a174eb65023f // indirect
7777
)
78-
79-
replace github.com/stacklok/propolis => ../propolis

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w
124124
github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
125125
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
126126
github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
127+
github.com/stacklok/propolis v0.0.5 h1:kA9Wd3B5SyHkh4ayDoVRKyz7Ejye9aNhos6CeSlBTtM=
128+
github.com/stacklok/propolis v0.0.5/go.mod h1:GK7TUXCm4J8Hh/QFoIGuXE4szSt8PWDZWzj1JPpqxVU=
127129
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
128130
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
129131
github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701 h1:pyC9PaHYZFgEKFdlp3G8RaCKgVpHZnecvArXvPXcFkM=

pkg/config/config.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ type Config struct {
8383
// LibDir is an optional path to the libkrun library directory.
8484
LibDir string
8585

86+
// CacheDir is the directory for extracted runtime bundles.
87+
// Defaults to DataDir when empty.
88+
CacheDir string
89+
8690
// Images maps runtime names to OCI image references.
8791
Images map[string]string
8892

@@ -168,6 +172,9 @@ func loadEnvStrings(cfg *Config) {
168172
if v := os.Getenv(EnvPrefix + "LIB_DIR"); v != "" {
169173
cfg.LibDir = v
170174
}
175+
if v := os.Getenv(EnvPrefix + "CACHE_DIR"); v != "" {
176+
cfg.CacheDir = filepath.Clean(v)
177+
}
171178
}
172179

173180
// loadEnvNumerics applies numeric-typed environment variables to cfg.

pkg/health/handler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ func (h *Handler) HandleReadyz(w http.ResponseWriter, r *http.Request) {
5050
if err := c.Check(r.Context()); err != nil {
5151
checks[c.Name()] = err.Error()
5252
healthy = false
53+
//nolint:gosec // G706: checker name and error are internal, not user input.
5354
slog.Warn("readiness check failed", "checker", c.Name(), "error", err)
5455
} else {
5556
checks[c.Name()] = "ok"

0 commit comments

Comments
 (0)