Skip to content

Commit

Permalink
oci artifact support
Browse files Browse the repository at this point in the history
Signed-off-by: James Sturtevant <[email protected]>
  • Loading branch information
jsturtevant committed Sep 30, 2023
1 parent fd40db4 commit 1879c99
Show file tree
Hide file tree
Showing 9 changed files with 7,311 additions and 965 deletions.
7,981 changes: 7,059 additions & 922 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ homepage = "https://github.com/deislabs/containerd-wasm-shims"
[workspace]
resolver = "2"
members = [
"tests"
"tests",
"containerd-shim-spin-v1"
]
26 changes: 20 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SHIMS := slight spin wws lunatic
SHIMS := spin
BUILD_TARGETS = $(foreach shim,$(SHIMS),build-$(shim)-cross-$(TARGET))

PREFIX ?= /usr/local
Expand Down Expand Up @@ -81,7 +81,7 @@ build-%:

.PHONY: install
install: $(foreach shim,$(SHIMS),build-$(shim))
sudo $(INSTALL) containerd-shim-*/target/release/containerd-shim-*-v1 $(PREFIX)/bin
sudo $(INSTALL) target/release/containerd-shim-*-v1 $(PREFIX)/bin

.PHONY: update-deps
update-deps:
Expand All @@ -96,12 +96,12 @@ 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: $(foreach shim,$(SHIMS),test/out_$(shim)/img-oci.tar)
$(foreach shim,$(SHIMS),sudo ../containerd/bin/ctr -n $(CONTAINERD_NAMESPACE) image import --all-platforms test/out_$(shim)/img-oci.tar;)

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

.PHONY: clean
clean: $(addprefix clean-,$(SHIMS))
Expand All @@ -110,4 +110,18 @@ clean: $(addprefix clean-,$(SHIMS))

.PHONY: clean-%
clean-%:
cargo clean --manifest-path containerd-shim-$*-v1/Cargo.toml
cargo clean --manifest-path containerd-shim-$*-v1/Cargo.toml

.PHONY: spin-oci
spin-oci:
mkdir -p staging
docker build -o staging ./images/spin
cargo install --path ../runwasi/crates/oci-tar-builder

# spin.json generated by spin registry push docker.io/jsturtevant/spin-wasm-shim:latest and looking at config
# must be updated if the app changes.
oci-tar-builder --name wasmtest_spin --repo docker.io/library --tag latest \
--module ./staging/spin_rust_hello.wasm \
--module ./staging/spin_go_hello.wasm \
--layer application/vnd.fermyon.spin.application.v1+config=./staging/spin.json \
-o test/out_spin/img-oci.tar
140 changes: 130 additions & 10 deletions containerd-shim-spin-v1/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions containerd-shim-spin-v1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ Containerd shim for running Spin workloads.

[dependencies]
containerd-shim = "0.5.0"
containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", rev = "4d212b968d24d42a27952e8b04979382b543a613", features = ["cgroupsv2"] }
#containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", rev = "4d212b968d24d42a27952e8b04979382b543a613", features = ["cgroupsv2"] }
containerd-shim-wasm = { path = "../../runwasi/crates/containerd-shim-wasm" }
log = "0.4"
spin-trigger = { git = "https://github.com/fermyon/spin", tag = "v1.5.0" }
spin-trigger-http = { git = "https://github.com/fermyon/spin", tag = "v1.5.0" }
spin-redis-engine = { git = "https://github.com/fermyon/spin", tag = "v1.5.0" }
spin-manifest = { git = "https://github.com/fermyon/spin", tag = "v1.5.0" }
spin-loader = { git = "https://github.com/fermyon/spin", tag = "v1.5.0" }
spin-trigger = { path = "../../spin/crates/trigger" }
spin-trigger-http = { path = "../../spin/crates/trigger-http" }
spin-redis-engine ={ path = "../../spin/crates/redis" }
spin-manifest = { path = "../../spin/crates/manifest" }
spin-loader = { path = "../../spin/crates/loader" }
spin-app = { path = "../../spin/crates/app" }
spin-oci = { path = "../../spin/crates/oci" }
wasmtime = "10.0.1"
tokio = { version = "1", features = ["rt"] }
openssl = { version = "*", features = ["vendored"] }
serde = "1.0"
serde_json = "1.0"
url = "2.3"
anyhow = "1.0"
oci-spec = { version = "0.6.1", features = ["runtime"] }

[workspace]
Loading

0 comments on commit 1879c99

Please sign in to comment.