|
| 1 | +name: Helm Chart Integration Test (legacy) |
| 2 | + |
| 3 | +on: |
| 4 | + # Run on merge to main |
| 5 | + push: |
| 6 | + branches: [ main ] |
| 7 | + # Run on pull requests |
| 8 | + pull_request: |
| 9 | + branches: [ main ] |
| 10 | + # Run nightly at 2 AM UTC |
| 11 | + schedule: |
| 12 | + - cron: '0 2 * * *' |
| 13 | + # Allow manual trigger |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +jobs: |
| 17 | + test-helm-chart: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout code |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Set up Helm |
| 25 | + uses: azure/setup-helm@v3 |
| 26 | + with: |
| 27 | + version: '3.12.0' |
| 28 | + |
| 29 | + - name: Update appVersion for nightly builds |
| 30 | + if: github.event_name == 'schedule' |
| 31 | + run: | |
| 32 | + echo "Updating appVersion to 2-nightly for scheduled builds" |
| 33 | + sed -i 's/^appVersion:.*/appVersion: 2-nightly/' charts/hdx-oss-v2/Chart.yaml |
| 34 | + echo "Updated Chart.yaml:" |
| 35 | + cat charts/hdx-oss-v2/Chart.yaml |
| 36 | +
|
| 37 | + - name: Create kind cluster config |
| 38 | + run: | |
| 39 | + cat > kind-config.yaml << EOF |
| 40 | + kind: Cluster |
| 41 | + apiVersion: kind.x-k8s.io/v1alpha4 |
| 42 | + nodes: |
| 43 | + - role: control-plane |
| 44 | + extraPortMappings: |
| 45 | + - containerPort: 30000 |
| 46 | + hostPort: 3000 |
| 47 | + protocol: TCP |
| 48 | + - containerPort: 30001 |
| 49 | + hostPort: 4318 |
| 50 | + protocol: TCP |
| 51 | + EOF |
| 52 | +
|
| 53 | + - name: Create kind cluster |
| 54 | + uses: helm/kind-action@v1 |
| 55 | + with: |
| 56 | + cluster_name: hyperdx-test-legacy |
| 57 | + config: kind-config.yaml |
| 58 | + |
| 59 | + - name: Install local-path-provisioner |
| 60 | + run: | |
| 61 | + kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.24/deploy/local-path-storage.yaml |
| 62 | + kubectl patch storageclass local-path -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' |
| 63 | +
|
| 64 | + - name: Run Helm unit tests |
| 65 | + run: | |
| 66 | + helm plugin install https://github.com/helm-unittest/helm-unittest.git || true |
| 67 | + helm unittest charts/hdx-oss-v2 |
| 68 | +
|
| 69 | + - name: Deploy hdx-oss-v2 chart |
| 70 | + run: | |
| 71 | + # Create test values for faster deployment |
| 72 | + cat > test-values.yaml << EOF |
| 73 | + hyperdx: |
| 74 | + apiKey: "test-api-key-for-ci" |
| 75 | + frontendUrl: "http://localhost:3000" |
| 76 | + replicas: 1 |
| 77 | + service: |
| 78 | + type: NodePort |
| 79 | + nodePort: 30000 |
| 80 | +
|
| 81 | + clickhouse: |
| 82 | + persistence: |
| 83 | + enabled: true |
| 84 | + dataSize: 2Gi |
| 85 | + logSize: 1Gi |
| 86 | +
|
| 87 | + mongodb: |
| 88 | + persistence: |
| 89 | + enabled: true |
| 90 | + dataSize: 2Gi |
| 91 | +
|
| 92 | + otel: |
| 93 | + resources: |
| 94 | + requests: |
| 95 | + memory: "128Mi" |
| 96 | + cpu: "100m" |
| 97 | + limits: |
| 98 | + memory: "256Mi" |
| 99 | + cpu: "200m" |
| 100 | + EOF |
| 101 | +
|
| 102 | + # Install the chart |
| 103 | + helm install hyperdx-test ./charts/hdx-oss-v2 -f test-values.yaml --timeout=5m |
| 104 | +
|
| 105 | + # Give services time to initialize after pods are running |
| 106 | + echo "Waiting for services to initialize..." |
| 107 | + sleep 20 |
| 108 | +
|
| 109 | + - name: Bootstrap team in MongoDB |
| 110 | + run: | |
| 111 | + # Wait for MongoDB to be ready |
| 112 | + kubectl wait --for=condition=Ready pods -l app=mongodb --timeout=300s |
| 113 | +
|
| 114 | + echo "Creating test team in MongoDB..." |
| 115 | + kubectl exec -n default deployment/hyperdx-test-hdx-oss-v2-mongodb -- mongosh hyperdx --eval " |
| 116 | + db.teams.insertOne({ |
| 117 | + name: 'CI Test Team', |
| 118 | + apiKey: 'test-api-key-for-ci', |
| 119 | + collectorAuthenticationEnforced: false, |
| 120 | + createdAt: new Date(), |
| 121 | + updatedAt: new Date() |
| 122 | + }) |
| 123 | + " |
| 124 | +
|
| 125 | + echo "Verifying team creation..." |
| 126 | + kubectl exec -n default deployment/hyperdx-test-hdx-oss-v2-mongodb -- mongosh hyperdx --eval " |
| 127 | + const team = db.teams.findOne({ apiKey: 'test-api-key-for-ci' }); |
| 128 | + if (team) { |
| 129 | + print('Team created successfully:', team.name); |
| 130 | + } else { |
| 131 | + print('Team creation failed'); |
| 132 | + exit(1); |
| 133 | + } |
| 134 | + " |
| 135 | +
|
| 136 | + echo "Waiting for OpAMP server to reconfigure collectors..." |
| 137 | + sleep 30 |
| 138 | +
|
| 139 | + - name: Verify deployment |
| 140 | + run: | |
| 141 | + echo "Initial pod status:" |
| 142 | + kubectl get pods -o wide |
| 143 | +
|
| 144 | + echo "Waiting for all pods to be ready..." |
| 145 | + kubectl wait --for=condition=Ready pods --all --timeout=600s |
| 146 | +
|
| 147 | + echo "Final pod status:" |
| 148 | + kubectl get pods -o wide |
| 149 | +
|
| 150 | + kubectl get services |
| 151 | +
|
| 152 | + - name: Run comprehensive smoke tests |
| 153 | + run: | |
| 154 | + chmod +x ./scripts/smoke-test.sh |
| 155 | +
|
| 156 | + RELEASE_NAME=hyperdx-test CHART_NAME=hdx-oss-v2 NAMESPACE=default ./scripts/smoke-test.sh |
| 157 | +
|
| 158 | + - name: Collect logs on failure |
| 159 | + if: failure() |
| 160 | + run: | |
| 161 | + echo "=== Pod Status ===" |
| 162 | + kubectl get pods -o wide |
| 163 | +
|
| 164 | + echo "=== Events ===" |
| 165 | + kubectl get events --sort-by=.metadata.creationTimestamp |
| 166 | +
|
| 167 | + echo "=== HyperDX App Logs ===" |
| 168 | + kubectl logs -l app=app --tail=100 || true |
| 169 | +
|
| 170 | + echo "=== ClickHouse Logs ===" |
| 171 | + kubectl logs -l app=clickhouse --tail=100 || true |
| 172 | +
|
| 173 | + echo "=== MongoDB Logs ===" |
| 174 | + kubectl logs -l app=mongodb --tail=100 || true |
| 175 | +
|
| 176 | + echo "=== OTEL Collector Logs ===" |
| 177 | + kubectl logs -l app=otel-collector --tail=100 || true |
| 178 | +
|
| 179 | + - name: Cleanup |
| 180 | + if: always() |
| 181 | + run: | |
| 182 | + helm uninstall hyperdx-test || true |
| 183 | + kind delete cluster --name hyperdx-test-legacy || true |
0 commit comments