Skip to content

Commit 50e8492

Browse files
authored
Merge pull request #82 from spinkube/reafactor-makefile
refactor(makefile): remove SHIMS from makefile
2 parents 01db2bf + a6e56f6 commit 50e8492

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

Makefile

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
SHIMS := spin
2-
BUILD_TARGETS = $(foreach shim,$(SHIMS),build-$(shim)-cross-$(TARGET))
1+
BUILD_TARGETS = build-spin-cross-$(TARGET)
32

43
PREFIX ?= /usr/local
54
INSTALL ?= install
@@ -21,7 +20,7 @@ test: unit-tests integration-tests
2120

2221
.PHONY: unit-tests
2322
unit-tests: build
24-
$(foreach shim,$(SHIMS),cross test --release --manifest-path=containerd-shim-$(shim)/Cargo.toml --target $(TARGET);)
23+
cross test --release --manifest-path=containerd-shim-spin/Cargo.toml --target $(TARGET)
2524

2625
.PHONY: check-bins
2726
check-bins:
@@ -70,7 +69,7 @@ fix:
7069
cargo clippy --all-targets --all-features --workspace --fix -- --deny=warnings
7170

7271
.PHONY: build
73-
build: $(foreach shim,$(SHIMS),build-$(shim)-cross-$(TARGET))
72+
build: build-spin-cross-$(TARGET)
7473
echo "Build complete"
7574

7675
# pin cross to a specific commit to avoid breaking changes
@@ -89,8 +88,8 @@ build-%:
8988
cargo build --release --manifest-path=containerd-shim-$*/Cargo.toml
9089

9190
.PHONY: install
92-
install: $(foreach shim,$(SHIMS),build-$(shim))
93-
sudo $(INSTALL) containerd-shim-*/target/release/containerd-shim-* $(PREFIX)/bin
91+
install: build-spin
92+
sudo $(INSTALL) ./target/release/containerd-shim-* $(PREFIX)/bin
9493

9594
.PHONY: update-deps
9695
update-deps:
@@ -105,16 +104,16 @@ test/out_%/img.tar: images/%/Dockerfile
105104
docker buildx build --provenance=false --platform=wasi/wasm --load -t $(TEST_IMG_NAME_$*) ./images/$*
106105
docker save -o $@ $(TEST_IMG_NAME_$*)
107106

108-
load: $(foreach shim,$(SHIMS),test/out_$(shim)/img.tar)
109-
$(foreach shim,$(SHIMS),sudo ctr -n $(CONTAINERD_NAMESPACE) image import test/out_$(shim)/img.tar;)
107+
load: test/out_spin/img.tar
108+
sudo ctr -n $(CONTAINERD_NAMESPACE) image import test/out_spin/img.tar
110109

111110
.PHONY: run_%
112111
run_%: install load
113112
sudo ctr run --net-host --rm --runtime=io.containerd.$*.v1 docker.io/library/$(TEST_IMG_NAME_$*) test$*
114113

115114
.PHONY: clean
116-
clean: $(addprefix clean-,$(SHIMS))
117-
$(foreach shim,$(SHIMS),test -f $(PREFIX)/bin/containerd-shim-$(shim)-* && sudo rm -rf $(PREFIX)/bin/containerd-shim-$(proj)-* || true;)
115+
clean: clean-spin
116+
test -f $(PREFIX)/bin/containerd-shim-spin-* && sudo rm -rf $(PREFIX)/bin/containerd-shim-$(proj)-* || true;
118117
test -d ./test && sudo rm -rf ./test || true
119118

120119
.PHONY: clean-%

deployments/k3d/Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
SHIMS = spin
21
SPIN_VERSION = v2
32
IMAGE_NAME ?= k3swithshims
43
CLUSTER_NAME ?= k3s-default
@@ -10,7 +9,7 @@ TEST_IMG_NAME_spin ?= wasmtest_spin:latest
109
compile-musl-%:
1110
make build-$*-cross-$(TARGET) -C ../..
1211

13-
move-musl-to-tmp: $(addprefix compile-musl-,$(SHIMS))
12+
move-musl-to-tmp: compile-musl-spin
1413
mkdir -p ./.tmp
1514
cp ../../containerd-shim-spin/target/$(TARGET)/release/containerd-shim-spin-$(SPIN_VERSION) ./.tmp/
1615

@@ -24,17 +23,17 @@ create-k3d: build-dev-k3d-image
2423
k3d cluster create $(CLUSTER_NAME) --image $(IMAGE_NAME) --api-port 6550 -p "8081:80@loadbalancer" --agents 1
2524

2625
build-workload-images:
27-
$(foreach shim,$(SHIMS),docker buildx build --platform=wasi/wasm --load -t $(TEST_IMG_NAME_$(shim)) ../../images/$(shim);)
26+
docker buildx build --platform=wasi/wasm --load -t $(TEST_IMG_NAME_spin) ../../images/spin
2827

2928
load-workload-images: build-workload-images
30-
$(foreach shim,$(SHIMS),k3d image load $(TEST_IMG_NAME_$(shim));)
29+
k3d image load $(TEST_IMG_NAME_spin)
3130

3231
up: create-k3d load-workload-images
3332
kubectl label nodes k3d-k3s-default-agent-0 spin-enabled=true
3433
kubectl apply -f ./workload
3534

3635
test:
37-
$(foreach shim,$(SHIMS),curl localhost:8081/$(shim)/hello;)
36+
curl localhost:8081/spin/hello
3837

3938
integration: move-musl-to-tmp
4039
cd ../.. && cargo test -- --nocapture

0 commit comments

Comments
 (0)