Skip to content

Commit

Permalink
upload k3s logs on failure
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Prendes <[email protected]>
  • Loading branch information
jprendes committed Oct 3, 2023
1 parent ba5ab5a commit 906988b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/action-test-k3s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ jobs:
run: |
sudo bin/k3s kubectl get pods --all-namespaces
sudo bin/k3s kubectl describe pods --all-namespaces
- name: tar logs
if: failure()
run: |
sudo journalctl -u k3s-runwasi > k3s.log
sudo tar czf k3s-logs-${{ inputs.runtime }}-${{ inputs.os }}.tar.gz -C . k3s.log -C /var/log/pods . -C /var/lib/rancher/k3s/agent/containerd/ containerd.log
sudo chown ${USER}:${USER} k3s-logs-${{ inputs.runtime }}-${{ inputs.os }}.tar.gz
- name: upload logs
if: failure()
uses: actions/upload-artifact@master
with:
name: k3s-logs-${{ inputs.runtime }}-${{ inputs.os }}
path: k3s-logs-${{ inputs.runtime }}-${{ inputs.os }}.tar.gz
- name: cleanup
if: always()
run: make test/k3s/clean
11 changes: 11 additions & 0 deletions .github/workflows/action-test-kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ jobs:
run: |
kubectl get pods --all-namespaces
kubectl describe pods --all-namespaces
- name: tar logs
if: failure()
run: |
bin/kind export logs ./kind-logs --name containerd-wasm
tar czf kind-logs-${{ inputs.runtime }}-${{ inputs.os }}.tar.gz -C ./kind-logs .
- name: upload logs
if: failure()
uses: actions/upload-artifact@master
with:
name: kind-logs-${{ inputs.runtime }}-${{ inputs.os }}
path: kind-logs-${{ inputs.runtime }}-${{ inputs.os }}.tar.gz
- name: cleanup
if: always()
run: make test/k8s/clean
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ INSTALL ?= install
LN ?= ln -sf
TEST_IMG_NAME ?= wasmtest:latest
RUNTIMES ?= wasmedge wasmtime wasmer
export CONTAINERD_NAMESPACE ?= default
CONTAINERD_NAMESPACE ?= default

TARGET ?= debug
RELEASE_FLAG :=
Expand All @@ -24,6 +24,8 @@ DOCKER_BUILD ?= docker buildx build

KIND_CLUSTER_NAME ?= containerd-wasm

export

.PHONY: build build-common build-wasm build-%
build: build-wasm $(RUNTIMES:%=build-%);

Expand Down Expand Up @@ -109,9 +111,11 @@ target/wasm32-wasi/$(TARGET)/wasi-demo-app.wasm:
target/wasm32-wasi/$(TARGET)/img.tar: target/wasm32-wasi/$(TARGET)/wasi-demo-app.wasm
cd crates/wasi-demo-app && cargo build $(RELEASE_FLAG) --features oci-v1-tar

dist/img.tar: target/wasm32-wasi/$(TARGET)/img.tar
.PHONY: dist/img.tar
dist/img.tar:
@mkdir -p "dist/"
cp "$<" "$@"
[ -f $(PWD)/dist/img.tar ] || $(MAKE) target/wasm32-wasi/$(TARGET)/img.tar
[ -f $(PWD)/dist/img.tar ] || cp target/wasm32-wasi/$(TARGET)/img.tar "$@"

load: dist/img.tar
sudo ctr -n $(CONTAINERD_NAMESPACE) image import --all-platforms $<
Expand Down

0 comments on commit 906988b

Please sign in to comment.