From 282df1c31e301c40a893c77b5076d7c24ea6a78d Mon Sep 17 00:00:00 2001 From: Swaraj Kumar Date: Mon, 10 Nov 2025 18:42:57 +0530 Subject: [PATCH] Update gerrit-verify.yaml for component-testing. Adding job "component-test" whose job is to: 1. Deploy a kind cluster 2. Deploy tm as a standalone component 3. Cast a +1/-1 vote depending of tm component status Issue-Id: AIMLFW-315 Change-Id: Ie63ebb5aa036a74faa9b1f7cad4a878c7ad9427a Signed-off-by: Swaraj Kumar --- .github/workflows/gerrit-verify.yaml | 115 +++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/.github/workflows/gerrit-verify.yaml b/.github/workflows/gerrit-verify.yaml index 006eacc..bf7991b 100644 --- a/.github/workflows/gerrit-verify.yaml +++ b/.github/workflows/gerrit-verify.yaml @@ -83,6 +83,121 @@ jobs: TOX_ENVS: '["code"]' PYTHON_VERSION: '3.10' + component-test: + needs: prepare + runs-on: ubuntu-latest + timeout-minutes: 20 + + steps: + - name: Gerrit checkout + # yamllint disable-line rule:line-length + uses: lfreleng-actions/checkout-gerrit-change-action@54d751e8bd167bc91f7d665dabe33fae87aaaa63 # v0.9 + with: + gerrit-refspec: ${{ inputs.GERRIT_REFSPEC }} + gerrit-project: ${{ inputs.GERRIT_PROJECT }} + gerrit-url: ${{ vars.GERRIT_URL }} + delay: "0s" + ref: refs/heads/${{ inputs.GERRIT_BRANCH }} + + - name: Clone dep repo + run: git clone https://github.com/o-ran-sc/aiml-fw-aimlfw-dep.git + + # Set up Docker image + - name: Build Docker image + run: | + docker build -t tm:latest . + + # Set up KinD cluster + - name: Create KinD cluster + uses: helm/kind-action@v1.8.0 + with: + cluster_name: ci-sample + + # Wait for KinD nodes to be ready + - name: Wait for nodes ready + run: kubectl wait --for=condition=Ready nodes --all --timeout=120s + + - name: Setup helm + run: | + cd aiml-fw-aimlfw-dep + ./bin/install_common_templates_to_helm.sh + + - name: Load Docker image into KinD + run: kind load docker-image tm:latest --name ci-sample + + - name: create traininghost namespace + run: kubectl create namespace traininghost + + - name: Install PostgreSQL database (tm-db) + run: | + echo "📦 Installing PostgreSQL (tm-db) in namespace traininghost..." + helm repo add bitnami https://charts.bitnami.com/bitnami + helm repo update + + helm install tm-db bitnami/postgresql \ + --set image.repository="bitnamilegacy/postgresql" \ + --set image.tag="17.6.0" \ + --set global.security.allowInsecureImages=true \ + --set auth.postgresPassword=postgres \ + --set primary.persistence.enabled=false \ + --namespace traininghost + + echo "⏳ Waiting for PostgreSQL pod to be ready..." + kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=postgresql -n traininghost --timeout=300s + + echo "✅ PostgreSQL installation complete." + kubectl get pods -n traininghost -l app.kubernetes.io/name=postgresql + + - name: Mock secrets for tm + run: | + set -euo pipefail + NAMESPACE=kubeflow + + echo "🔧 Creating namespace if missing..." + kubectl create namespace $NAMESPACE --dry-run=client -o yaml | kubectl apply -f - + + echo "🔐 Creating mock secret: leofs-secret" + kubectl create secret generic leofs-secret \ + --from-literal=password="dummy-s3-secret-key" \ + -n $NAMESPACE --dry-run=client -o yaml | kubectl apply -f - + + - name: install tm + run: | + cd aiml-fw-aimlfw-dep + helm dep up helm/tm + helm install tm helm/tm -f RECIPE_EXAMPLE/example_recipe_local_images_oran_latest.yaml + + - name: Wait for tm pod ready + run: | + set -euo pipefail + NAMESPACE=traininghost + + echo "🔍 Checking pod status before waiting..." + kubectl get pods -n $NAMESPACE -o wide || true + + echo "📋 Describing any non-running pods (pre-check)..." + kubectl get pods -n $NAMESPACE --no-headers | awk '$3 != "Running" {print $1}' | \ + xargs -r -I {} kubectl describe pod {} -n $NAMESPACE || true + + echo "⏳ Waiting for all pods in namespace '$NAMESPACE' to be Ready (max 300s)..." + if ! kubectl wait --for=condition=Ready pod --namespace $NAMESPACE --all --timeout=300s; then + echo "❌ Timeout waiting for pods. Dumping debug info..." + echo "🔹 Current pod states:" + kubectl get pods -n $NAMESPACE -o wide || true + echo "🔹 Recent events:" + kubectl get events -n $NAMESPACE --sort-by=.lastTimestamp | tail -n 20 || true + exit 1 + fi + + echo "✅ All pods in '$NAMESPACE' are Ready." + echo "📊 Final pod status:" + kubectl get pods -n $NAMESPACE -o wide + + - name: list tm pod + run: | + kubectl get pods -n traininghost + kubectl get svc -n traininghost + vote: if: ${{ always() }} # yamllint enable rule:line-length -- 2.16.6