diff --git a/Makefile b/Makefile index aebc7da..9f1a5b7 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,4 @@ -SHIMS := spin -BUILD_TARGETS = $(foreach shim,$(SHIMS),build-$(shim)-cross-$(TARGET)) +BUILD_TARGETS = build-spin-cross-$(TARGET) PREFIX ?= /usr/local INSTALL ?= install @@ -21,7 +20,7 @@ test: unit-tests integration-tests .PHONY: unit-tests unit-tests: build - $(foreach shim,$(SHIMS),cross test --release --manifest-path=containerd-shim-$(shim)/Cargo.toml --target $(TARGET);) + cross test --release --manifest-path=containerd-shim-spin/Cargo.toml --target $(TARGET) .PHONY: check-bins check-bins: @@ -70,7 +69,7 @@ fix: cargo clippy --all-targets --all-features --workspace --fix -- --deny=warnings .PHONY: build -build: $(foreach shim,$(SHIMS),build-$(shim)-cross-$(TARGET)) +build: build-spin-cross-$(TARGET) echo "Build complete" # pin cross to a specific commit to avoid breaking changes @@ -89,8 +88,8 @@ build-%: cargo build --release --manifest-path=containerd-shim-$*/Cargo.toml .PHONY: install -install: $(foreach shim,$(SHIMS),build-$(shim)) - sudo $(INSTALL) containerd-shim-*/target/release/containerd-shim-* $(PREFIX)/bin +install: build-spin + sudo $(INSTALL) ./target/release/containerd-shim-* $(PREFIX)/bin .PHONY: update-deps update-deps: @@ -105,16 +104,16 @@ test/out_%/img.tar: images/%/Dockerfile docker buildx build --provenance=false --platform=wasi/wasm --load -t $(TEST_IMG_NAME_$*) ./images/$* docker save -o $@ $(TEST_IMG_NAME_$*) -load: $(foreach shim,$(SHIMS),test/out_$(shim)/img.tar) - $(foreach shim,$(SHIMS),sudo ctr -n $(CONTAINERD_NAMESPACE) image import test/out_$(shim)/img.tar;) +load: test/out_spin/img.tar + sudo ctr -n $(CONTAINERD_NAMESPACE) image import test/out_spin/img.tar .PHONY: run_% run_%: install load sudo ctr run --net-host --rm --runtime=io.containerd.$*.v1 docker.io/library/$(TEST_IMG_NAME_$*) test$* .PHONY: clean -clean: $(addprefix clean-,$(SHIMS)) - $(foreach shim,$(SHIMS),test -f $(PREFIX)/bin/containerd-shim-$(shim)-* && sudo rm -rf $(PREFIX)/bin/containerd-shim-$(proj)-* || true;) +clean: clean-spin + test -f $(PREFIX)/bin/containerd-shim-spin-* && sudo rm -rf $(PREFIX)/bin/containerd-shim-$(proj)-* || true; test -d ./test && sudo rm -rf ./test || true .PHONY: clean-% diff --git a/deployments/k3d/Makefile b/deployments/k3d/Makefile index 25c8412..ec631be 100644 --- a/deployments/k3d/Makefile +++ b/deployments/k3d/Makefile @@ -1,4 +1,3 @@ -SHIMS = spin SPIN_VERSION = v2 IMAGE_NAME ?= k3swithshims CLUSTER_NAME ?= k3s-default @@ -10,7 +9,7 @@ TEST_IMG_NAME_spin ?= wasmtest_spin:latest compile-musl-%: make build-$*-cross-$(TARGET) -C ../.. -move-musl-to-tmp: $(addprefix compile-musl-,$(SHIMS)) +move-musl-to-tmp: compile-musl-spin mkdir -p ./.tmp cp ../../containerd-shim-spin/target/$(TARGET)/release/containerd-shim-spin-$(SPIN_VERSION) ./.tmp/ @@ -24,17 +23,17 @@ create-k3d: build-dev-k3d-image k3d cluster create $(CLUSTER_NAME) --image $(IMAGE_NAME) --api-port 6550 -p "8081:80@loadbalancer" --agents 1 build-workload-images: - $(foreach shim,$(SHIMS),docker buildx build --platform=wasi/wasm --load -t $(TEST_IMG_NAME_$(shim)) ../../images/$(shim);) + docker buildx build --platform=wasi/wasm --load -t $(TEST_IMG_NAME_spin) ../../images/spin load-workload-images: build-workload-images - $(foreach shim,$(SHIMS),k3d image load $(TEST_IMG_NAME_$(shim));) + k3d image load $(TEST_IMG_NAME_spin) up: create-k3d load-workload-images kubectl label nodes k3d-k3s-default-agent-0 spin-enabled=true kubectl apply -f ./workload test: - $(foreach shim,$(SHIMS),curl localhost:8081/$(shim)/hello;) + curl localhost:8081/spin/hello integration: move-musl-to-tmp cd ../.. && cargo test -- --nocapture