[wip] Helm install smoke test #76
This file contains 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
name: Docker | |
on: | |
push: | |
branches: [ main ] | |
tags: [ "v*" ] | |
pull_request: | |
branches: [ main ] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
# docker: | |
# runs-on: ubuntu-latest | |
# permissions: | |
# pull-requests: write | |
# contents: read | |
# packages: write | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v4 | |
# - name: Setup version info - main | |
# if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} | |
# run: echo "VERSION=$(date +%Y%m%d-%H%M%S)-g$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
# - name: Setup version info - tag | |
# if: startsWith(github.ref, 'refs/tags/v') | |
# run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV | |
# - name: Set up QEMU | |
# uses: docker/setup-qemu-action@v3 | |
# - name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v3 | |
# - name: Log into registry ${{ env.REGISTRY }} | |
# if: github.ref == 'refs/heads/main' | |
# uses: docker/login-action@v3 | |
# with: | |
# registry: ${{ env.REGISTRY }} | |
# username: ${{ github.actor }} | |
# password: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Extract Docker metadata | |
# id: meta | |
# uses: docker/metadata-action@v5 | |
# with: | |
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# - name: Build and Push PR - Ephemeral | |
# uses: docker/build-push-action@v5 | |
# if: github.event_name == 'pull_request' | |
# with: | |
# context: . | |
# push: true | |
# labels: ${{ steps.meta.outputs.labels }} | |
# platforms: linux/amd64,linux/arm64 | |
# cache-from: type=gha | |
# cache-to: type=gha,mode=max | |
# tags: | | |
# ttl.sh/spoopy-operator-pr-${{ github.event.pull_request.number }}:24h | |
# - uses: mshick/add-pr-comment@v2 | |
# if: (github.event_name == 'pull_request') && ${{ success() }} | |
# with: | |
# message: | | |
# This PR now has an image available for testing: | |
# ``` | |
# ttl.sh/spoopy-operator-pr-${{ github.event.pull_request.number }}:24h | |
# ``` | |
# - name: Build and Push | |
# uses: docker/build-push-action@v5 | |
# if: github.ref == 'refs/heads/main' | |
# with: | |
# context: . | |
# push: true | |
# labels: ${{ steps.meta.outputs.labels }} | |
# platforms: linux/amd64,linux/arm64 | |
# cache-from: type=gha | |
# cache-to: type=gha,mode=max | |
# tags: | | |
# ghcr.io/spinkube/spin-operator:${{ env.VERSION }} | |
helm-install-smoke-test: | |
runs-on: ubuntu-latest | |
# needs: docker | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21.x" | |
- name: Install helm | |
uses: Azure/setup-helm@v3 | |
with: | |
version: v3.14.0 | |
- name: setup k3d | |
uses: engineerd/[email protected] | |
with: | |
name: k3d | |
url: https://github.com/k3d-io/k3d/releases/download/v5.6.0/k3d-linux-amd64 | |
- name: start k3d cluster | |
run: | | |
k3d cluster create wasm-cluster \ | |
--image ghcr.io/deislabs/containerd-wasm-shims/examples/k3d:v0.11.0 \ | |
--port "8081:80@loadbalancer" \ | |
--agents 2 | |
- name: install crd | |
run: make install | |
- name: apply runtime class | |
run: kubectl apply -f spin-runtime-class.yaml | |
- name: helm install | |
run: | | |
helm repo add kwasm-operator http://kwasm.sh/kwasm-operator | |
helm repo add cert-manager https://charts.jetstack.io | |
helm dependency build charts/spin-operator | |
helm install spin-operator \ | |
--namespace spin-operator \ | |
--create-namespace \ | |
--devel \ | |
--wait \ | |
--set controllerManager.manager.image.repository=ttl.sh/spoopy-operator-pr-${{ github.event.number }} \ | |
--set controllerManager.manager.image.tag=24h \ | |
--debug \ | |
charts/spin-operator | |
- name: debug | |
if: always() | |
run: kubectl get pods -A | |
- name: annotate nodes | |
run: kubectl annotate node --all kwasm.sh/kwasm-node=true | |
- name: run spin app | |
run: | | |
kubectl apply -f config/samples/simple.yaml | |
kubectl rollout status deployment simple-spinapp --timeout 90s | |
kubectl port-forward svc/simple-spinapp 8083:80 & | |
timeout 15s bash -c 'until curl -f -vvv http://localhost:8083/hello; do sleep 2; done' | |
- name: Verify curl | |
run: curl localhost:8083/hello |