-
Notifications
You must be signed in to change notification settings - Fork 13
ci(*): update helm-chart-smoketest.yml, add wasmtime-v1 coverage #605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vdice
wants to merge
2
commits into
spinframework:main
Choose a base branch
from
vdice:ci/update-smoketest-add-wasmtime-coverage
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -153,60 +153,96 @@ jobs: | |
| --set rcm.shimDownloaderImage.tag=chart-test \ | ||
| deploy/helm | ||
|
|
||
| - name: apply Spin shim | ||
| - name: apply shims | ||
| run: | | ||
| shim_file=config/samples/test_shim_spin.yaml | ||
| if [[ "${{ matrix.config.type }}" == "microk8s" ]]; then | ||
| cp $shim_file config/samples/test_shim_spin_microk8s.yaml | ||
| shim_file=config/samples/test_shim_spin_microk8s.yaml | ||
| # update file to remove the 'containerdRuntimeOptions' field | ||
| # as there is a known bug that MicroK8s containerd does not pass the options | ||
| yq -i 'del(.spec.containerdRuntimeOptions)' $shim_file | ||
| fi | ||
| kubectl apply -f $shim_file | ||
|
|
||
| - name: label nodes | ||
| run: kubectl label node --all spin=true | ||
|
|
||
| - name: verify only one installer pod with Succeeded status | ||
| # TODO: provisioning on k3d still leads to the first installer pod finishing with provisioner status Unknown and phase Failed | ||
| if: matrix.config.type != 'k3d' | ||
| for shim_file in $(ls config/samples/sample_shim*); do | ||
| if [[ "${{ matrix.config.type }}" == "microk8s" ]]; then | ||
| cp $shim_file $shim_file.microk8s | ||
| shim_file=$shim_file.microk8s | ||
| # update file to remove the 'containerdRuntimeOptions' field | ||
| # as there is a known bug that MicroK8s containerd does not pass the options | ||
| yq -i 'del(.spec.containerdRuntimeOptions)' $shim_file | ||
| fi | ||
| kubectl apply -f $shim_file | ||
| done | ||
|
|
||
| - name: label nodes and wait for shim to be ready | ||
| run: | | ||
| timeout 60s bash -c 'until [[ "$(kubectl -n rcm get $(kubectl get pods -n rcm --no-headers -o name | grep install | head -n1) -o jsonpath="{.status.phase}" 2>/dev/null)" == "Succeeded" ]]; do sleep 2; done' | ||
| for shim_file in $(ls config/samples/sample_shim*); do | ||
| label="$(cat $shim_file | yq '.spec.nodeSelector' | tr -d '"' | tr -d '[:space:]' | sed s/:/=/g)" | ||
| kubectl label node --all $label | ||
|
|
||
| shim_name="$(cat $shim_file | yq '.metadata.name')" | ||
| # TODO: k3d can take a long round of failed install pods (exit code 6 when curling the artifact?) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For K3d, |
||
| # Once this behavior is diagnosed and resolved, we should be able to shorten this timeout substantially | ||
| timeout=600 | ||
| SECONDS=0 # Reset the internal bash timer to 0 | ||
| success=false | ||
|
|
||
| echo "Waiting for the $shim_name shim to be ready/installed..." | ||
|
|
||
| while [[ $SECONDS -lt $timeout ]]; do | ||
| # Fetch both nodes and nodesReady | ||
| read -r nodes nodesReady <<< $(kubectl get shim "$shim_name" \ | ||
| -o jsonpath='{.status.nodes} {.status.nodesReady}' 2>/dev/null) | ||
|
|
||
| # Check to see if all nodes are ready | ||
| if [[ -n "$nodes" ]] && [[ -n "$nodesReady" ]] && [[ "$nodes" -eq "$nodesReady" ]]; then | ||
| echo "Success: all nodes have the $shim_name shim installed." | ||
| success=true | ||
| break | ||
| fi | ||
|
|
||
| sleep 2 | ||
| done | ||
|
|
||
| if [[ "${success}" != "true" ]]; then | ||
| echo "Error: Timed out after ${timeout}s waiting for the $shim_name shim to be ready." | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| - name: run Spin App | ||
| # TODO: unify testdata/apps to all model the same behavor, eg simple web server, etc | ||
| - name: run and verify spin app | ||
| run: | | ||
| kubectl apply -f testdata/apps/spin-app.yaml | ||
| kubectl rollout status deployment wasm-spin --timeout 180s | ||
| kubectl get pods -A | ||
| kubectl port-forward svc/wasm-spin 8083:80 & | ||
| timeout 90s bash -c 'until curl -f -vvv http://localhost:8083/hello; do sleep 2; done' | ||
| kubectl apply -f testdata/apps/spin-v2-app.yaml | ||
| kubectl rollout status deployment spin-v2-app --timeout 180s | ||
| kubectl port-forward svc/spin-v2-app 8083:80 & | ||
| timeout 60s bash -c 'until curl -f -vvv http://localhost:8083/hello; do sleep 2; done' | ||
|
|
||
| - name: restart system containerd | ||
| if: matrix.config.type == 'microk8s' | ||
| run: sudo systemctl start containerd | ||
| - name: run and verify wasmtime app | ||
| run: | | ||
| kubectl apply -f testdata/apps/wasmtime-v1-app.yaml | ||
| kubectl rollout status deployment wasmtime-v1-app --timeout 180s | ||
| pod=$(kubectl get pod -l app=wasmtime-v1-app -o name) | ||
| timeout 60s bash -c 'until kubectl logs $1 | grep -q "This is a song that never ends."; do sleep 2; done' -- $pod | ||
|
|
||
| - name: debug | ||
| if: failure() | ||
| run: | | ||
| kubectl get pods -A | ||
| kubectl describe shim spin-v2 | ||
| kubectl describe runtimeclass wasmtime-spin-v2 | ||
| kubectl describe shims | ||
| kubectl describe runtimeclasses | ||
|
|
||
| # Get install pod logs | ||
| # Note: there may be multiple pods pending k3d fix for issue https://github.com/spinframework/runtime-class-manager/issues/393 | ||
| install_pod=$(kubectl get pods -n rcm --no-headers -o name | awk '{if ($1 ~ "-spin-v2-install") print $0}' | tail -n 1) | ||
| kubectl describe -n rcm $install_pod || true | ||
| kubectl logs -n rcm -c downloader $install_pod || true | ||
| kubectl logs -n rcm -c provisioner $install_pod || true | ||
| for shim_file in $(ls config/samples/sample_shim*); do | ||
| shim_name="$(cat $shim_file | yq '.metadata.name')" | ||
| install_pods="$(kubectl get pods -n rcm --no-headers -o name | grep $shim_name-install)" | ||
| for pod in $install_pods; do | ||
| kubectl describe -n rcm $pod || true | ||
| kubectl logs -n rcm -c downloader $pod || true | ||
| kubectl logs -n rcm -c provisioner $pod || true | ||
| done | ||
| done | ||
|
|
||
| # RCM pod logs | ||
| kubectl logs -n rcm -l app.kubernetes.io/name=runtime-class-manager || true | ||
| kubectl describe -n rcm pod -l app.kubernetes.io/name=runtime-class-manager || true | ||
|
|
||
| # App logs | ||
| kubectl logs -l app=wasm-spin || true | ||
| kubectl describe pod -l app=wasm-spin || true | ||
|
|
||
| - name: Verify curl | ||
| run: curl localhost:8083/hello | ||
| for app_file in $(ls testdata/apps/*); do | ||
| app=$(cat $app_file | yq 'select(.kind == "Deployment") | .metadata.name') | ||
| kubectl logs -l app=$app || true | ||
| kubectl describe pod -l app=$app || true | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ spec: | |
|
|
||
| runtimeClass: | ||
| name: wasmtime-v1 | ||
| handler: wasmtime | ||
| handler: wasmtime-v1 | ||
|
|
||
| rolloutStrategy: | ||
| type: recreate | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: wasmtime-v1-app | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: wasmtime-v1-app | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: wasmtime-v1-app | ||
| spec: | ||
| runtimeClassName: wasmtime-v1 | ||
| containers: | ||
| - name: wasmtime-v1-app | ||
| image: ghcr.io/containerd/runwasi/wasi-demo-app:latest |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think script is fine but can we move these to a
scripts/directory and call the scripts instead of inlining here?