-
Notifications
You must be signed in to change notification settings - Fork 15
Add OCI image support #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
2b6c42b
291a3e9
39b51ec
755b944
d03cba6
cd16a06
edf1082
2fd5111
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ SRCS := \ | |
| core/vdso.c \ | ||
| core/shim-globals.c \ | ||
| core/bootstrap.c \ | ||
| core/launch.c \ | ||
| core/rosetta.c \ | ||
| core/sysroot.c \ | ||
| runtime/thread.c \ | ||
|
|
@@ -100,7 +101,7 @@ endef | |
| .PHONY: all elfuse | ||
| .PHONY: gen-syscall-dispatch check-syscall-dispatch | ||
|
|
||
| all: elfuse | ||
| all: elfuse elfuse-container | ||
|
|
||
| ## Regenerate build/dispatch.h from src/syscall/dispatch.tbl | ||
| gen-syscall-dispatch: | ||
|
|
@@ -125,6 +126,55 @@ elfuse: $(ELFUSE_BIN) | |
| $(ELFUSE_BIN): $(OBJS) | $(BUILD_DIR) | ||
| $(call link-and-sign,$@,$(OBJS)) | ||
|
|
||
| # OCI container CLI (Go). Pure Go, no HVF entitlement or codesigning required, | ||
| # so it also builds under Linux for spec-conformance / interop CI. The version | ||
| # is stamped from the same VERSION string the C binary uses. | ||
| CONTAINER_BIN := $(BUILD_DIR)/elfuse-container | ||
| CONTAINER_SRCS := $(shell find cmd/elfuse-container -type f -name '*.go' 2>/dev/null) | ||
|
|
||
| .PHONY: elfuse-container | ||
| elfuse-container: $(CONTAINER_BIN) | ||
|
|
||
| # OCI image-layout conformance + cross-tool interop. Pulls fixtures into a | ||
| # throwaway store and asserts the on-disk layout is spec-shaped and readable by | ||
| # crane/skopeo/umoci (whichever are installed locally; all are required in CI). | ||
| # Pure Go + jq; no HVF, runs on Linux. Requires network to pull fixtures. | ||
| .PHONY: oci-interop | ||
| oci-interop: $(CONTAINER_BIN) | ||
| $(Q)scripts/oci-interop.sh | ||
|
|
||
| # Go unit tests for the OCI container CLI (offline). Set ELFUSE_OCI_NETTEST=1 | ||
| # to also exercise the network pull round-trip conformance test. | ||
| .PHONY: oci-test | ||
| oci-test: | ||
| $(Q)$(GO) test ./cmd/elfuse-container/ | ||
|
|
||
| # gofmt + go vet gate for the OCI container CLI. `go vet` is run for both GOOS | ||
| # values so the darwin-only sparsebundle files are checked from Linux CI and the | ||
| # non-darwin stubs are checked from a macOS host. oci-lint bundles both so a | ||
| # local run matches the CI gate. | ||
| .PHONY: oci-vet oci-fmt-check oci-lint | ||
| oci-vet: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: The Prompt for AI agents |
||
| $(Q)$(GO) vet ./cmd/elfuse-container/ | ||
| $(Q)GOOS=darwin $(GO) vet ./cmd/elfuse-container/ | ||
| $(Q)GOOS=linux $(GO) vet ./cmd/elfuse-container/ | ||
|
|
||
| oci-fmt-check: | ||
| $(Q)out="$$(gofmt -l cmd/elfuse-container)"; \ | ||
| if [ -n "$$out" ]; then \ | ||
| echo "gofmt needs to run on:"; echo "$$out"; exit 1; \ | ||
| fi | ||
|
|
||
| oci-lint: oci-fmt-check oci-vet | ||
|
|
||
| # rm -f first: `go build -o` follows an existing symlink at the output path, | ||
| # so a stale build/elfuse-container symlink would clobber build/elfuse. | ||
| $(CONTAINER_BIN): go.mod $(CONTAINER_SRCS) | $(BUILD_DIR) | ||
| @echo " GO $@" | ||
| $(Q)rm -f $@ | ||
| $(Q)cd $(CURDIR) && $(GO) build -ldflags "-X main.version=$(VERSION)" \ | ||
| -o $@ ./cmd/elfuse-container | ||
|
|
||
| # Native test binaries (macOS, Hypervisor.framework) | ||
|
|
||
| ## Build the multi-vCPU HVF validation test (native macOS binary) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.