|
| 1 | +name: Helm Chart End-to-End Test |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - 'chart/**' |
| 7 | + - '.github/workflows/**' |
| 8 | + push: |
| 9 | + paths: |
| 10 | + - 'chart/**' |
| 11 | + - '.github/workflows/**' |
| 12 | + |
| 13 | +jobs: |
| 14 | + e2e: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + permissions: |
| 17 | + contents: read |
| 18 | + env: |
| 19 | + RELEASE_NAME: openops |
| 20 | + NAMESPACE: openops |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Set up Helm |
| 25 | + uses: azure/setup-helm@v4 |
| 26 | + with: |
| 27 | + version: v3.14.4 |
| 28 | + |
| 29 | + - name: Create kind cluster |
| 30 | + uses: helm/kind-action@v1.9.0 |
| 31 | + with: |
| 32 | + cluster_name: openops-e2e |
| 33 | + wait: 180s |
| 34 | + |
| 35 | + - name: Verify cluster |
| 36 | + run: | |
| 37 | + set -euo pipefail |
| 38 | + kubectl cluster-info |
| 39 | + kubectl get nodes -o wide |
| 40 | +
|
| 41 | + - name: Deploy chart |
| 42 | + run: | |
| 43 | + set -euo pipefail |
| 44 | + helm upgrade --install "$RELEASE_NAME" chart \ |
| 45 | + --namespace "$NAMESPACE" \ |
| 46 | + --create-namespace \ |
| 47 | + -f chart/values.ci.yaml \ |
| 48 | + --set nginx.service.type=ClusterIP \ |
| 49 | + --wait \ |
| 50 | + --timeout 20m |
| 51 | +
|
| 52 | + - name: Wait for workloads |
| 53 | + run: | |
| 54 | + set -euo pipefail |
| 55 | + kubectl get pods -n "$NAMESPACE" -o wide |
| 56 | + kubectl wait --for=condition=Available deployment --all -n "$NAMESPACE" --timeout=900s |
| 57 | +
|
| 58 | + - name: Verify application health endpoint |
| 59 | + run: | |
| 60 | + set -euo pipefail |
| 61 | + kubectl get svc -n "$NAMESPACE" |
| 62 | + kubectl port-forward -n "$NAMESPACE" svc/openops-app 18080:80 >/tmp/port-forward.log 2>&1 & |
| 63 | + pf_pid=$! |
| 64 | + cleanup() { |
| 65 | + kill "$pf_pid" >/dev/null 2>&1 || true |
| 66 | + } |
| 67 | + trap cleanup EXIT |
| 68 | + for attempt in $(seq 1 12); do |
| 69 | + if curl -fsS http://127.0.0.1:18080/api/v1/health; then |
| 70 | + echo "Health endpoint responded on attempt $attempt" |
| 71 | + exit 0 |
| 72 | + fi |
| 73 | + sleep 5 |
| 74 | + done |
| 75 | + echo "Health endpoint did not become ready" >&2 |
| 76 | + exit 1 |
| 77 | +
|
| 78 | + - name: Gather diagnostics on failure |
| 79 | + if: ${{ failure() }} |
| 80 | + run: | |
| 81 | + kubectl get all -n "$NAMESPACE" |
| 82 | + kubectl describe pods -n "$NAMESPACE" || true |
| 83 | + kubectl logs -n "$NAMESPACE" deployment/openops-app --tail=200 || true |
0 commit comments