Skip to content

Commit 34b7091

Browse files
committed
ci(.github): add helm chart smoketest workflow
Signed-off-by: Vaughn Dice <[email protected]>
1 parent 3c90630 commit 34b7091

File tree

3 files changed

+154
-0
lines changed

3 files changed

+154
-0
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ permissions:
1717
checks: write
1818

1919
jobs:
20+
helm_install_smoke_test:
21+
uses: ./.github/workflows/helm-chart-smoketest.yml
22+
2023
unit_tests:
2124
name: Test
2225
runs-on: ubuntu-latest
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Helm Chart Smoketest
2+
3+
on:
4+
workflow_call:
5+
6+
env:
7+
SPIN_OPERATOR_VERSION: 0.3.0
8+
SPIN_SHIM_VERSION: v0.15.1
9+
10+
jobs:
11+
helm-install-smoke-test:
12+
runs-on: ubuntu-22.04
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install helm
17+
uses: Azure/setup-helm@v4
18+
with:
19+
version: v3.15.4
20+
21+
- name: Set up QEMU
22+
uses: docker/setup-qemu-action@v3
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
27+
- name: Build RCM
28+
uses: docker/build-push-action@v6
29+
with:
30+
context: .
31+
file: ./Dockerfile
32+
platforms: linux/amd64
33+
cache-from: type=gha
34+
cache-to: type=gha,mode=max
35+
load: true
36+
tags: |
37+
runtime-class-manager:chart-test
38+
39+
- name: Build node installer
40+
uses: docker/build-push-action@v6
41+
with:
42+
context: .
43+
file: ./images/installer/Dockerfile
44+
platforms: linux/amd64
45+
cache-from: type=gha
46+
cache-to: type=gha,mode=max
47+
load: true
48+
tags: |
49+
node-installer:chart-test
50+
51+
- name: Build shim downloader
52+
uses: docker/build-push-action@v6
53+
with:
54+
context: ./images/downloader
55+
file: ./images/downloader/Dockerfile
56+
platforms: linux/amd64
57+
cache-from: type=gha
58+
cache-to: type=gha,mode=max
59+
load: true
60+
tags: |
61+
shim-downloader:chart-test
62+
63+
- name: create kind cluster
64+
uses: helm/kind-action@v1
65+
with:
66+
cluster_name: kind
67+
68+
- name: import images into kind cluster
69+
run: |
70+
kind load docker-image runtime-class-manager:chart-test
71+
kind load docker-image node-installer:chart-test
72+
kind load docker-image shim-downloader:chart-test
73+
74+
- name: helm install runtime-class-manager
75+
run: |
76+
helm install rcm \
77+
--namespace rcm \
78+
--create-namespace \
79+
--debug \
80+
--set image.repository=runtime-class-manager \
81+
--set image.tag=chart-test \
82+
--set rcm.nodeInstallerImage.repository=node-installer \
83+
--set rcm.nodeInstallerImage.tag=chart-test \
84+
--set rcm.shimDownloaderImage.repository=shim-downloader \
85+
--set rcm.shimDownloaderImage.tag=chart-test \
86+
deploy/helm
87+
88+
- name: apply Spin shim
89+
run: |
90+
# Ensure shim binary is compatible with runner arch
91+
yq -i '.spec.fetchStrategy.anonHttp.location = "https://github.com/spinkube/containerd-shim-spin/releases/download/${{ env.SHIM_SPIN_VERSION}}/containerd-shim-spin-v2-linux-amd64.tar.gz"' \
92+
config/samples/test_shim_spin.yaml
93+
kubectl apply -f config/samples/test_shim_spin.yaml
94+
95+
- name: label nodes
96+
run: kubectl label node --all spin=true
97+
98+
- name: run Spin App
99+
run: |
100+
kubectl apply -f testdata/apps/spin-app.yaml
101+
kubectl rollout status deployment wasm-spin --timeout 90s
102+
kubectl get pods -A
103+
kubectl port-forward svc/wasm-spin 8083:80 &
104+
timeout 15s bash -c 'until curl -f -vvv http://localhost:8083/hello; do sleep 2; done'
105+
106+
- name: debug
107+
if: failure()
108+
run: |
109+
kubectl get pods -A
110+
kubectl describe shim spin-v2
111+
kubectl describe runtimeclass wasmtime-spin-v2
112+
kubectl describe -n rcm pod -l job-name=kind-control-plane-spin-v2-install || true
113+
kubectl logs -n rcm -l app.kubernetes.io/name=runtime-class-manager || true
114+
kubectl describe -n rcm pod -l app.kubernetes.io/name=runtime-class-manager || true
115+
kubectl logs -l app=wasm-spin || true
116+
kubectl describe pod -l app=wasm-spin || true
117+
118+
- name: Verify curl
119+
run: curl localhost:8083/hello

testdata/apps/spin-app.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: wasm-spin
6+
spec:
7+
replicas: 1
8+
selector:
9+
matchLabels:
10+
app: wasm-spin
11+
template:
12+
metadata:
13+
labels:
14+
app: wasm-spin
15+
spec:
16+
runtimeClassName: wasmtime-spin-v2
17+
containers:
18+
- name: spin-hello
19+
image: ghcr.io/spinkube/spin-operator/hello-world:20240909-145818-g30def7d
20+
command: ["/"]
21+
---
22+
apiVersion: v1
23+
kind: Service
24+
metadata:
25+
name: wasm-spin
26+
spec:
27+
ports:
28+
- protocol: TCP
29+
port: 80
30+
targetPort: 80
31+
selector:
32+
app: wasm-spin

0 commit comments

Comments
 (0)