Skip to content

Commit 570a9fe

Browse files
committed
feat(*): use published images instead of locally built ones
- Replaced `make load` with `sudo make pull` - Updated documents to pull images from `ghcr.io` instead of building them locally Signed-off-by: Jiaxiao (mossaka) Zhou <duibao55328@gmail.com>
1 parent 5088658 commit 570a9fe

10 files changed

Lines changed: 35 additions & 47 deletions

File tree

.github/workflows/action-test-smoke.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ jobs:
4444
run: |
4545
ls -alh dist
4646
ls -alh dist/bin
47-
make load
4847
sudo cp -f dist/bin/* /usr/local/bin
48+
sudo make pull-app
4949
sudo ctr run --rm --runtime=io.containerd.${{ inputs.runtime }}.v1 ghcr.io/containerd/runwasi/wasi-demo-app:latest testwasm /wasi-demo-app.wasm echo 'hello'
5050
- name: Verify Jaeger traces
5151
run: |

.github/workflows/benchmarks.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Build and load shims and wasi-demo-app
2929
shell: bash
3030
run: |
31-
make OPT_PROFILE=release build install test-image load test-image/oci load/oci
31+
make OPT_PROFILE=release build install pull
3232
- name: Run Benchmarks
3333
shell: bash
3434
run: |
@@ -69,7 +69,7 @@ jobs:
6969
- name: Build and load shims and wasi-demo-app
7070
shell: bash
7171
run: |
72-
make OPT_PROFILE=release build install test-image load test-image/oci load/oci
72+
make OPT_PROFILE=release build install pull
7373
- name: Run Benchmarks
7474
shell: bash
7575
run: |
@@ -113,7 +113,7 @@ jobs:
113113
- name: Build and load shims and wasi-demo-app
114114
shell: bash
115115
run: |
116-
make OPT_PROFILE=release build install test-image/http load/http
116+
make OPT_PROFILE=release build install pull
117117
- name: Start wasmtime shim
118118
shell: bash
119119
run: |

Makefile

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -215,27 +215,30 @@ dist/img-oci-artifact.tar: target/wasm32-wasip1/$(OPT_PROFILE)/img-oci-artifact.
215215
@mkdir -p "dist/"
216216
cp "$<" "$@"
217217

218-
load: dist/img.tar
219-
sudo ctr -n $(CONTAINERD_NAMESPACE) image import --all-platforms $<
218+
.PHONY: pull pull-app pull-oci pull-oci-artifact pull-http
219+
pull: pull-app pull-oci pull-oci-artifact pull-http
220+
echo "Pulled all images"
221+
222+
pull-app:
223+
ctr image pull ghcr.io/containerd/runwasi/wasi-demo-app:latest
224+
225+
pull-oci:
226+
ctr image pull ghcr.io/containerd/runwasi/wasi-demo-oci:latest
227+
228+
pull-oci-artifact:
229+
ctr image pull ghcr.io/containerd/runwasi/wasi-demo-oci-artifact:latest
230+
231+
pull-http:
232+
ctr image pull ghcr.io/containerd/runwasi/wasi-http:latest
220233

221234
docker/load: dist/img.tar
222235
docker load -i $<
223236

224-
CTR_VERSION := $(shell sudo ctr version | sed -n -e '/Version/ {s/.*: *//p;q;}')
225-
load/oci: dist/img-oci.tar dist/img-oci-artifact.tar
226-
@echo $(CTR_VERSION)\\nv1.7.7 | sort -crV || @echo $(CTR_VERSION)\\nv1.6.25 | sort -crV || (echo "containerd version must be 1.7.7+ or 1.6.25+ was $(CTR_VERSION)" && exit 1)
227-
@echo using containerd $(CTR_VERSION)
228-
sudo ctr -n $(CONTAINERD_NAMESPACE) image import --all-platforms $<
229-
sudo ctr -n $(CONTAINERD_NAMESPACE) image import --all-platforms dist/img-oci-artifact.tar
230-
231237
docker/load/oci: dist/img-oci.tar dist/img-oci-artifact.tar
232238
docker load -i dist/img-oci.tar
233239
docker load -i dist/img-oci-artifact.tar
234240

235-
.PHONY: load/http
236-
load/http: dist/http-img-oci.tar
237-
sudo ctr -n $(CONTAINERD_NAMESPACE) image import --all-platforms $<
238-
241+
.PHONY: docker/load/http
239242
docker/load/http: dist/http-img-oci.tar
240243
docker load -i $<
241244

@@ -276,9 +279,8 @@ test/nginx:
276279
mkdir -p $@/out && docker save -o $@/out/img.tar docker.io/nginx:latest
277280

278281
.PHONY: test/k8s/cluster-%
279-
test/k8s/cluster-%: dist/img.tar bin/kind test/k8s/_out/img-%
280-
bin/kind create cluster --name $(KIND_CLUSTER_NAME) --image="$(shell cat test/k8s/_out/img-$*)" && \
281-
bin/kind load image-archive --name $(KIND_CLUSTER_NAME) $(<)
282+
test/k8s/cluster-%: bin/kind test/k8s/_out/img-%
283+
bin/kind create cluster --name $(KIND_CLUSTER_NAME) --image="$(shell cat test/k8s/_out/img-$*)"
282284

283285

284286
.PHONY: test/k8s/deploy-workload-%
@@ -290,9 +292,7 @@ test/k8s/deploy-workload-%: test/k8s/clean test/k8s/cluster-%
290292
kubectl --context=kind-$(KIND_CLUSTER_NAME) wait deployment wasi-demo --for condition=Available=True --timeout=5s
291293

292294
.PHONY: test/k8s/deploy-workload-oci-%
293-
test/k8s/deploy-workload-oci-%: test/k8s/clean test/k8s/cluster-% dist/img-oci.tar dist/img-oci-artifact.tar test/k8s/cluster-%
294-
bin/kind load image-archive --name $(KIND_CLUSTER_NAME) dist/img-oci.tar
295-
bin/kind load image-archive --name $(KIND_CLUSTER_NAME) dist/img-oci-artifact.tar
295+
test/k8s/deploy-workload-oci-%: test/k8s/clean test/k8s/cluster-%
296296
kubectl --context=kind-$(KIND_CLUSTER_NAME) apply -f test/k8s/deploy.oci.yaml
297297
kubectl --context=kind-$(KIND_CLUSTER_NAME) wait deployment wasi-demo --for condition=Available=True --timeout=300s
298298
# verify that we are still running after some time
@@ -333,7 +333,7 @@ bin/k3s/clean:
333333

334334
.PHONY: test/k3s-%
335335
test/k3s-%: dist/img.tar bin/k3s dist-%
336-
sudo bash -c -- 'while ! timeout 40 test/k3s/bootstrap.sh "$*" dist/img.tar; do $(MAKE) bin/k3s/clean bin/k3s; done'
336+
sudo bash -c -- 'while ! timeout 40 test/k3s/bootstrap.sh "$*"; do $(MAKE) bin/k3s/clean bin/k3s; done'
337337
sudo bin/k3s kubectl get pods --all-namespaces
338338
sudo bin/k3s kubectl apply -f test/k8s/deploy.yaml
339339
sudo bin/k3s kubectl get pods --all-namespaces
@@ -346,8 +346,8 @@ test/k3s-%: dist/img.tar bin/k3s dist-%
346346
sudo bin/k3s kubectl wait deployment wasi-demo --for delete --timeout=60s
347347

348348
.PHONY: test/k3s-oci-%
349-
test/k3s-oci-%: dist/img-oci.tar bin/k3s dist-%
350-
sudo bash -c -- 'while ! timeout 40 test/k3s/bootstrap.sh "$*" dist/img-oci.tar; do $(MAKE) bin/k3s/clean bin/k3s; done'
349+
test/k3s-oci-%: bin/k3s dist-%
350+
sudo bash -c -- 'while ! timeout 40 test/k3s/bootstrap.sh "$*"; do $(MAKE) bin/k3s/clean bin/k3s; done'
351351
sudo bin/k3s kubectl get pods --all-namespaces
352352
sudo bin/k3s kubectl apply -f test/k8s/deploy.oci.yaml
353353
sudo bin/k3s kubectl get pods --all-namespaces

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,10 @@ sudo make install
146146

147147
> Note: `make build` will only build one binary. The `make install` command copies the binary to $PATH and uses symlinks to create all the component described above.
148148
149-
Build the test image and load it into containerd:
149+
Pull the test image:
150150

151151
```
152-
make test-image
153-
make load
152+
sudo make pull-app
154153
```
155154

156155
### Demo 1 using container image that contains a Wasm module.
@@ -185,11 +184,10 @@ To learn more about this approach checkout the [design document](https://docs.go
185184

186185
> **Note**: This requires containerd 1.7.7+ and 1.6.25+. If you do not have these patches for both `containerd` and `ctr` you will end up with an error message such as `mismatched image rootfs and manifest layers` at the import and run steps. Latest versions of k3s and kind have the necessary containerd versions.
187186
188-
Build and import the OCI image with WASM layers image:
187+
Pull the OCI image with WASM layers image:
189188

190189
```
191-
make test-image/oci
192-
make load/oci
190+
sudo make pull
193191
```
194192

195193
Run the image with `sudo ctr run --rm --runtime=io.containerd.[ wasmedge | wasmtime | wasmer | wamr ].v1 ghcr.io/containerd/runwasi/wasi-demo-oci:latest testwasmoci`
@@ -205,8 +203,6 @@ exiting
205203
The [CNCF tag-runtime wasm working group](https://tag-runtime.cncf.io/wgs/wasm/charter/) has a [OCI Artifact format for Wasm](https://tag-runtime.cncf.io/wgs/wasm/deliverables/wasm-oci-artifact/). This is a new Artifact type that enable the usage across projects beyond just runwasi, see the https://tag-runtime.cncf.io/wgs/wasm/deliverables/wasm-oci-artifact/#implementations
206204

207205
```
208-
make test-image/oci
209-
make load/oci
210206
make test/k8s-oci-wasmtime
211207
```
212208

benches/containerd-shim-benchmarks/README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@ make build
1010
sudo make install
1111
```
1212

13-
Then, build and load the wasi-demo-app:
13+
Then, pull the wasi-demo-app:
1414
```bash
15-
make test-image
16-
make load
17-
make test-image/oci
18-
make load/oci
15+
sudo make pull
1916
```
2017

2118
To run all benchmarks:

crates/containerd-shim-wasmtime/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ cargo run --bin oci-tar-builder -- \
5757
-o ./dist/wasi-http-img-oci.tar
5858
```
5959

60-
- Import the image:
60+
- Pull the image:
6161

6262
```shell
63-
sudo ctr image import --all-platforms ./dist/wasi-http-img-oci.tar
63+
sudo make pull-http
6464
```
6565

6666
- Run the image:

docs/windows-getting-started.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ To finish off installing pre-requisites, install Rust following [this](https://w
1515
After following these steps and navigating to the runwasi directory in your terminal:
1616
- run `make build`,
1717
- run `make install`,
18-
- run `make test-image`, and
19-
- run `make load`.
18+
- run `sudo make pull-app`.
2019

2120
After this, you can execute an example, like: `ctr run --rm --runtime=io.containerd.wasmtime.v1 ghcr.io/containerd/runwasi/wasi-demo-app:latest testwasm`.
2221

test/k3s/bootstrap.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@ EOF
1616
systemctl daemon-reload
1717
systemctl restart k3s-runwasi
1818
while ! bin/k3s ctr version; do sleep 1; done
19-
bin/k3s ctr image import --all-platforms $2
2019
while [ "$(bin/k3s kubectl get pods --all-namespaces --no-headers | wc -l)" == "0" ]; do sleep 1; done
2120
while [ "$(bin/k3s kubectl get pods --all-namespaces --no-headers | grep -vE "Completed|Running" | wc -l)" != "0" ]; do sleep 1; done

test/k8s/deploy.oci.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ spec:
2424
containers:
2525
- name: demo
2626
image: ghcr.io/containerd/runwasi/wasi-demo-oci:latest
27-
imagePullPolicy: Never
2827
- name: demo-artifact
2928
image: ghcr.io/containerd/runwasi/wasi-demo-oci-artifact:latest
30-
imagePullPolicy: Never
3129
command: ["wasi-demo.wasm"]
3230
- name: nginx
3331
image: docker.io/nginx:latest

test/k8s/deploy.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ spec:
2424
containers:
2525
- name: demo
2626
image: ghcr.io/containerd/runwasi/wasi-demo-app:latest
27-
imagePullPolicy: Never
2827
- name: nginx
2928
image: docker.io/nginx:latest
3029
ports:

0 commit comments

Comments
 (0)