-
Notifications
You must be signed in to change notification settings - Fork 0
Integration gh workflow for test install and uninstall #6
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| name: 'Smoke Test' | ||
| description: 'Install, verify, uninstall, and debug the developer quickstart' | ||
|
|
||
| inputs: | ||
| timeout: | ||
| description: 'Timeout for install/uninstall scripts' | ||
| required: false | ||
| default: '300s' | ||
| overlay: | ||
| description: 'Overlay name for component verification (matches .github/config/overlays/<name>.env)' | ||
| required: false | ||
| default: 'base' | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Run install script | ||
| shell: bash | ||
| env: | ||
| LOCAL_DIR: . | ||
| TIMEOUT: ${{ inputs.timeout }} | ||
| run: ./install.sh | ||
|
|
||
| - name: Verify deployments | ||
| shell: bash | ||
| env: | ||
| OVERLAY: ${{ inputs.overlay }} | ||
| run: .github/scripts/verify-install.sh | ||
|
|
||
| - name: Run uninstall script | ||
| shell: bash | ||
| env: | ||
| LOCAL_DIR: . | ||
| TIMEOUT: ${{ inputs.timeout }} | ||
| run: ./uninstall.sh | ||
|
|
||
| - name: Verify uninstall | ||
| shell: bash | ||
| run: .github/scripts/verify-uninstall.sh | ||
|
|
||
| - name: Debug on failure | ||
| if: failure() | ||
| shell: bash | ||
| env: | ||
| OVERLAY: ${{ inputs.overlay }} | ||
| run: .github/scripts/debug.sh | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| kind: Cluster | ||
| apiVersion: kind.x-k8s.io/v1alpha4 | ||
| nodes: | ||
| - role: control-plane | ||
| kubeadmConfigPatches: | ||
| - | | ||
| kind: InitConfiguration | ||
| nodeRegistration: | ||
| kubeletExtraArgs: | ||
| node-labels: "ingress-ready=true" | ||
| extraPortMappings: | ||
| - containerPort: 80 | ||
| hostPort: 80 | ||
| protocol: TCP | ||
| - containerPort: 443 | ||
| hostPort: 443 | ||
| protocol: TCP |
|
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. It is nice to have this separated out, but there are other elements (like the install and uninstall scripts) that need the overlay details. So I wonder if it would be possible to do this programmatically by looking at the kustomizations. However, that is premature optimization and once we merge this we can look at other options. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Components expected in the base (default) deployment. | ||
| # Used by verify-install.sh, verify-uninstall.sh, and debug.sh. | ||
| # | ||
| # Format: | ||
| # OPERATORS - "namespace:deployment" pairs (space-separated) | ||
| # CUSTOM_RESOURCES - "namespace:resource" pairs (space-separated) | ||
| # NAMESPACES - namespaces to inspect on failure (space-separated) | ||
|
|
||
| OPERATORS="strimzi:strimzi-cluster-operator apicurio-registry:apicurio-registry-operator streamshub-console:streamshub-console-operator" | ||
| CUSTOM_RESOURCES="kafka:kafka/dev-cluster apicurio-registry:apicurioregistry3/apicurio-registry streamshub-console:console.console.streamshub.github.com/streamshub-console" | ||
| NAMESPACES="strimzi kafka apicurio-registry streamshub-console" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Dump diagnostic information for debugging failed smoke tests. | ||
| # Reads component definitions from an overlay config file. | ||
| # | ||
| # Environment variables: | ||
| # OVERLAY - overlay name (default: "base") | ||
| # | ||
|
|
||
| set +e | ||
|
|
||
| OVERLAY="${OVERLAY:-base}" | ||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| CONFIG_FILE="${SCRIPT_DIR}/../config/overlays/${OVERLAY}.env" | ||
|
|
||
| if [ ! -f "${CONFIG_FILE}" ]; then | ||
| echo "ERROR: Overlay config not found: ${CONFIG_FILE}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # shellcheck disable=SC1090 | ||
| source "${CONFIG_FILE}" | ||
|
|
||
| echo "=== CR status ===" | ||
| for entry in ${CUSTOM_RESOURCES}; do | ||
| ns="${entry%%:*}" | ||
| resource="${entry#*:}" | ||
| kubectl get "${resource}" -n "${ns}" -o yaml 2>/dev/null || true | ||
| done | ||
| echo "" | ||
| echo "=== Events (all namespaces) ===" | ||
| kubectl get events --all-namespaces --sort-by='.lastTimestamp' | tail -50 | ||
| echo "" | ||
| echo "=== Pods (all namespaces) ===" | ||
| kubectl get pods --all-namespaces | ||
| echo "" | ||
| for ns in ${NAMESPACES}; do | ||
| echo "=== Pods in ${ns} ===" | ||
| kubectl get pods -n "${ns}" -o wide 2>/dev/null || true | ||
| echo "=== Pod logs in ${ns} ===" | ||
| for pod in $(kubectl get pods -n "${ns}" -o name 2>/dev/null); do | ||
| echo "--- ${pod} ---" | ||
| kubectl logs "${pod}" -n "${ns}" --tail=30 2>/dev/null || true | ||
| done | ||
| done |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Verify that all expected deployments and custom resources are ready. | ||
| # Reads component definitions from an overlay config file. | ||
| # | ||
| # Environment variables: | ||
| # OVERLAY - overlay name (default: "base") | ||
| # TIMEOUT - kubectl wait timeout (default: "600s") | ||
| # | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| OVERLAY="${OVERLAY:-base}" | ||
| TIMEOUT="${TIMEOUT:-600s}" | ||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| CONFIG_FILE="${SCRIPT_DIR}/../config/overlays/${OVERLAY}.env" | ||
|
|
||
| if [ ! -f "${CONFIG_FILE}" ]; then | ||
| echo "ERROR: Overlay config not found: ${CONFIG_FILE}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # shellcheck disable=SC1090 | ||
| source "${CONFIG_FILE}" | ||
|
|
||
| echo "=== Verifying install (overlay: ${OVERLAY}) ===" | ||
| echo "" | ||
|
|
||
| for entry in ${OPERATORS}; do | ||
| ns="${entry%%:*}" | ||
| deploy="${entry#*:}" | ||
| echo "--- ${deploy} (${ns}) ---" | ||
| kubectl get deployment -n "${ns}" "${deploy}" | ||
| done | ||
|
|
||
| echo "" | ||
|
|
||
| for entry in ${CUSTOM_RESOURCES}; do | ||
| ns="${entry%%:*}" | ||
| resource="${entry#*:}" | ||
| echo "--- ${resource} (${ns}) ---" | ||
| kubectl wait "${resource}" --for=condition=Ready -n "${ns}" --timeout="${TIMEOUT}" | ||
| done |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Verify that all quick-start resources have been removed after uninstall. | ||
| # | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| QUICKSTART_LABEL="app.kubernetes.io/part-of=streamshub-developer-quickstart" | ||
|
|
||
| echo "--- Checking for remaining quick-start resources ---" | ||
| remaining=$(kubectl get all -A -l "${QUICKSTART_LABEL}" --no-headers 2>/dev/null | wc -l | tr -d ' ') | ||
| if [ "$remaining" -gt 0 ]; then | ||
| echo "ERROR: Found $remaining remaining resources after uninstall:" | ||
| kubectl get all -A -l "${QUICKSTART_LABEL}" | ||
| exit 1 | ||
| fi | ||
| echo "All quick-start resources successfully removed" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| name: Integration Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| smoke-minikube: | ||
| name: smoke-minikube | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Start Minikube | ||
| id: minikube | ||
| uses: medyagh/setup-minikube@e9e035a86bbc3caea26a450bd4dbf9d0c453682e # v0.0.21 | ||
| with: | ||
| minikube-version: 'latest' | ||
| addons: registry,ingress,ingress-dns | ||
| insecure-registry: 'localhost:5000,10.0.0.0/24' | ||
| start-args: '--extra-config=kubeadm.ignore-preflight-errors=SystemVerification --extra-config=apiserver.authorization-mode=RBAC,Node' | ||
|
|
||
| - name: Smoke test | ||
| uses: ./.github/actions/smoke-test | ||
|
|
||
| smoke-kind: | ||
| name: smoke-kind | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Create Kind cluster | ||
| uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0 | ||
| with: | ||
| config: .github/config/kind-config.yaml | ||
|
|
||
| - name: Deploy ingress-nginx | ||
| run: | | ||
| kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.12.1/deploy/static/provider/kind/deploy.yaml | ||
| kubectl wait --namespace ingress-nginx \ | ||
| --for=condition=Ready pod \ | ||
| --selector=app.kubernetes.io/component=controller \ | ||
| --timeout=120s | ||
|
|
||
| - name: Smoke test | ||
| uses: ./.github/actions/smoke-test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # VSCode | ||
| .vscode | ||
|
|
||
| # IntelliJ IDEA specific | ||
| .idea/ | ||
| *.iml | ||
|
|
||
| ### Mac OS ### | ||
| **.DS_Store |
Uh oh!
There was an error while loading. Please reload this page.