From 6c0dd5a3a8e503fe790d04a4b2535c0115cd07eb Mon Sep 17 00:00:00 2001 From: rioloc Date: Thu, 20 Aug 2026 10:36:23 +0200 Subject: [PATCH] Add E2E integration test for lightspeed-agentic-alerts-adapter Configure CI to run E2E tests using cluster pool claim on feat-e2e-test-impl branch. Changes: - Add e2e-integration test with cluster_claim (pool: obs, OCP 4.21 on AWS) - Create step-registry ref that deploys adapter using hack/deploy-e2e.sh - Run Ginkgo E2E test suite (deduplication, reconciliation tests) - Auto-install lightspeed-agentic-operator for AgenticRun CRD if needed - Collect artifacts: adapter logs, events, AgenticRun resources Test Details: - Target branch: feat-e2e-test-impl (where E2E tests are implemented) - Trigger: Automatic on every PR (always_run: true) - Branch pattern: ^feat-e2e-test-impl$ and ^feat-e2e-test-impl- - Optional: Does not block merge on failure - Timeout: 3h30m (1h cluster claim + 2h test + cleanup) - Rerun: /test e2e-integration Note: Once feat-e2e-test-impl is merged to main, rename config file from feat-e2e-test-impl.yaml to main.yaml and the branch will automatically update to main. Co-Authored-By: Claude Sonnet 4.5 --- ...ightspeed-agentic-alerts-adapter-main.yaml | 17 +++ ...gentic-alerts-adapter-main-presubmits.yaml | 90 +++++++++++++++ .../lightspeed-agentic-alerts-adapter/OWNERS | 15 +++ ...htspeed-agentic-alerts-adapter-commands.sh | 104 ++++++++++++++++++ ...d-agentic-alerts-adapter-ref.metadata.json | 15 +++ ...lightspeed-agentic-alerts-adapter-ref.yaml | 29 +++++ 6 files changed, 270 insertions(+) create mode 100644 ci-operator/step-registry/lightspeed-agentic-alerts-adapter/OWNERS create mode 100755 ci-operator/step-registry/lightspeed-agentic-alerts-adapter/lightspeed-agentic-alerts-adapter-commands.sh create mode 100644 ci-operator/step-registry/lightspeed-agentic-alerts-adapter/lightspeed-agentic-alerts-adapter-ref.metadata.json create mode 100644 ci-operator/step-registry/lightspeed-agentic-alerts-adapter/lightspeed-agentic-alerts-adapter-ref.yaml diff --git a/ci-operator/config/openshift/lightspeed-agentic-alerts-adapter/openshift-lightspeed-agentic-alerts-adapter-main.yaml b/ci-operator/config/openshift/lightspeed-agentic-alerts-adapter/openshift-lightspeed-agentic-alerts-adapter-main.yaml index b7867d264eae8..4114e607bc042 100644 --- a/ci-operator/config/openshift/lightspeed-agentic-alerts-adapter/openshift-lightspeed-agentic-alerts-adapter-main.yaml +++ b/ci-operator/config/openshift/lightspeed-agentic-alerts-adapter/openshift-lightspeed-agentic-alerts-adapter-main.yaml @@ -31,6 +31,23 @@ tests: container: from: src skip_if_only_changed: ^docs/|\.md$|^(?:.*/)?(?:\.gitignore|OWNERS|LICENSE)$ +- always_run: true + as: e2e-integration + cluster_claim: + architecture: amd64 + cloud: aws + labels: + region: us-east-1 + owner: obs + product: ocp + timeout: 1h0m0s + version: "4.21" + optional: true + steps: + test: + - ref: lightspeed-agentic-alerts-adapter + workflow: generic-claim + timeout: 3h30m0s zz_generated_metadata: branch: main org: openshift diff --git a/ci-operator/jobs/openshift/lightspeed-agentic-alerts-adapter/openshift-lightspeed-agentic-alerts-adapter-main-presubmits.yaml b/ci-operator/jobs/openshift/lightspeed-agentic-alerts-adapter/openshift-lightspeed-agentic-alerts-adapter-main-presubmits.yaml index 1440a3a2ade36..f4575a3a90199 100644 --- a/ci-operator/jobs/openshift/lightspeed-agentic-alerts-adapter/openshift-lightspeed-agentic-alerts-adapter-main-presubmits.yaml +++ b/ci-operator/jobs/openshift/lightspeed-agentic-alerts-adapter/openshift-lightspeed-agentic-alerts-adapter-main-presubmits.yaml @@ -1,5 +1,95 @@ presubmits: openshift/lightspeed-agentic-alerts-adapter: + - agent: kubernetes + always_run: true + branches: + - ^main$ + - ^main- + cluster: build10 + context: ci/prow/e2e-integration + decorate: true + decoration_config: + sparse_checkout_files: + - Containerfile + timeout: 3h30m0s + labels: + ci.openshift.io/generator: prowgen + pj-rehearse.openshift.io/can-be-rehearsed: "true" + name: pull-ci-openshift-lightspeed-agentic-alerts-adapter-main-e2e-integration + optional: true + rerun_command: /test e2e-integration + spec: + containers: + - args: + - --gcs-upload-secret=/secrets/gcs/service-account.json + - --hive-kubeconfig=/secrets/hive-hive-credentials/kubeconfig + - --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson + - --lease-server-credentials-file=/etc/boskos/credentials + - --report-credentials-file=/etc/report/credentials + - --secret-dir=/secrets/ci-pull-credentials + - --target=e2e-integration + command: + - ci-operator + env: + - name: HTTP_SERVER_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: quay-proxy.ci.openshift.org/openshift/ci:ci_ci-operator_latest + imagePullPolicy: Always + name: "" + ports: + - containerPort: 8080 + name: http + resources: + requests: + cpu: 10m + volumeMounts: + - mountPath: /etc/boskos + name: boskos + readOnly: true + - mountPath: /secrets/ci-pull-credentials + name: ci-pull-credentials + readOnly: true + - mountPath: /secrets/gcs + name: gcs-credentials + readOnly: true + - mountPath: /secrets/hive-hive-credentials + name: hive-hive-credentials + readOnly: true + - mountPath: /secrets/manifest-tool + name: manifest-tool-local-pusher + readOnly: true + - mountPath: /etc/pull-secret + name: pull-secret + readOnly: true + - mountPath: /etc/report + name: result-aggregator + readOnly: true + serviceAccountName: ci-operator + volumes: + - name: boskos + secret: + items: + - key: credentials + path: credentials + secretName: boskos-credentials + - name: ci-pull-credentials + secret: + secretName: ci-pull-credentials + - name: hive-hive-credentials + secret: + secretName: hive-hive-credentials + - name: manifest-tool-local-pusher + secret: + secretName: manifest-tool-local-pusher + - name: pull-secret + secret: + secretName: registry-pull-credentials + - name: result-aggregator + secret: + secretName: result-aggregator + trigger: (?m)^/test( | .* )e2e-integration,?($|\s.*) - agent: kubernetes always_run: true branches: diff --git a/ci-operator/step-registry/lightspeed-agentic-alerts-adapter/OWNERS b/ci-operator/step-registry/lightspeed-agentic-alerts-adapter/OWNERS new file mode 100644 index 0000000000000..afb4114c6d864 --- /dev/null +++ b/ci-operator/step-registry/lightspeed-agentic-alerts-adapter/OWNERS @@ -0,0 +1,15 @@ +# DO NOT EDIT; this file is auto-generated using https://github.com/openshift/ci-tools. +# Fetched from https://github.com/openshift/lightspeed-agentic-alerts-adapter root OWNERS +# If the repo had OWNERS_ALIASES then the aliases were expanded +# Logins who are not members of 'openshift' organization were filtered out +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + +approvers: +- falox +- rioloc +- tremes +options: {} +reviewers: +- falox +- rioloc +- tremes diff --git a/ci-operator/step-registry/lightspeed-agentic-alerts-adapter/lightspeed-agentic-alerts-adapter-commands.sh b/ci-operator/step-registry/lightspeed-agentic-alerts-adapter/lightspeed-agentic-alerts-adapter-commands.sh new file mode 100755 index 0000000000000..123756c98e874 --- /dev/null +++ b/ci-operator/step-registry/lightspeed-agentic-alerts-adapter/lightspeed-agentic-alerts-adapter-commands.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +set -euo pipefail + +STEP_SECONDS=0 + +function log { + echo "[$(date '+%Y-%m-%d %H:%M:%S')] [+$((SECONDS / 60))m$((SECONDS % 60))s] $*" +} + +function start_step { + STEP_SECONDS=$SECONDS + log "=== START: $* ===" +} + +function end_step { + local step_duration=$((SECONDS - STEP_SECONDS)) + log "=== END: $* (took $((step_duration / 60))m$((step_duration % 60))s) ===" +} + +function collect_artifacts { + set +e + log "=== Collecting debug artifacts ===" + + # Adapter resources + oc describe pods -n "${NAMESPACE}" > "${ARTIFACT_DIR}/adapter-pod-describe.txt" 2>&1 || true + oc logs "deployment/${DEPLOYMENT_NAME}" -n "${NAMESPACE}" --all-containers > "${ARTIFACT_DIR}/adapter-logs.txt" 2>&1 || true + oc logs "deployment/${DEPLOYMENT_NAME}" -n "${NAMESPACE}" --all-containers --previous > "${ARTIFACT_DIR}/adapter-logs-previous.txt" 2>&1 || true + oc get events -n "${NAMESPACE}" --sort-by='.lastTimestamp' > "${ARTIFACT_DIR}/adapter-events.txt" 2>&1 || true + oc get all -n "${NAMESPACE}" -o yaml > "${ARTIFACT_DIR}/adapter-resources.yaml" 2>&1 || true + + # AgenticRun CRs created during test + oc get agenticruns -n "${NAMESPACE}" -o yaml > "${ARTIFACT_DIR}/agenticruns.yaml" 2>&1 || true + + # Operator resources (if present) + if [[ -n "${OPERATOR_NAMESPACE:-}" ]]; then + oc describe pods -n "${OPERATOR_NAMESPACE}" > "${ARTIFACT_DIR}/operator-pod-describe.txt" 2>&1 || true + oc logs -n "${OPERATOR_NAMESPACE}" -l app=lightspeed-agentic-operator --all-containers > "${ARTIFACT_DIR}/operator-logs.txt" 2>&1 || true + fi + + log "=== Artifacts collected in ${ARTIFACT_DIR} ===" + log "=== Total script duration: $((SECONDS / 60))m$((SECONDS % 60))s (${SECONDS}s) ===" +} + +trap collect_artifacts EXIT + +log "=== Lightspeed Agentic Alerts Adapter E2E ===" +log "IMAGE: ${IMAGE}" +log "NAMESPACE: ${NAMESPACE}" +log "DEPLOYMENT_NAME: ${DEPLOYMENT_NAME}" +log "OPERATOR_NAMESPACE: ${OPERATOR_NAMESPACE:-openshift-lightspeed}" + +start_step "Installing prerequisites" +# Ensure oc and yq are available +if ! command -v oc &>/dev/null; then + log "ERROR: oc command not found" + exit 1 +fi + +if ! command -v yq &>/dev/null; then + log "Installing yq..." + YQ_VERSION="v4.40.5" + YQ_BINARY="yq_linux_amd64" + + # Create private directory for binary + YQ_DIR=$(mktemp -d) + chmod 700 "${YQ_DIR}" + + # Download binary and checksums + curl --fail --show-error --location \ + "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY}" \ + -o "${YQ_DIR}/yq" + curl --fail --show-error --location \ + "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/checksums" \ + -o "${YQ_DIR}/checksums" + + # Verify checksum + (cd "${YQ_DIR}" && grep "${YQ_BINARY}" checksums | sha256sum --check --status) || { + log "ERROR: yq checksum verification failed" + rm -rf "${YQ_DIR}" + exit 1 + } + + chmod +x "${YQ_DIR}/yq" + export PATH="${YQ_DIR}:${PATH}" + log "yq installed at ${YQ_DIR}/yq" +fi +end_step "Installing prerequisites" + +start_step "Deploy adapter with make deploy-e2e" +# The deploy-e2e.sh script expects IMAGE env var and uses the defaults we set +make deploy-e2e +end_step "Deploy adapter with make deploy-e2e" + +start_step "Run E2E test suite" +# Run the Ginkgo-based E2E test suite (30m timeout in Makefile) +make test-e2e +end_step "Run E2E test suite" + +start_step "Cleanup with make undeploy-e2e" +make undeploy-e2e +end_step "Cleanup with make undeploy-e2e" + +log "=== E2E test complete ===" diff --git a/ci-operator/step-registry/lightspeed-agentic-alerts-adapter/lightspeed-agentic-alerts-adapter-ref.metadata.json b/ci-operator/step-registry/lightspeed-agentic-alerts-adapter/lightspeed-agentic-alerts-adapter-ref.metadata.json new file mode 100644 index 0000000000000..ad2e9b706f5c0 --- /dev/null +++ b/ci-operator/step-registry/lightspeed-agentic-alerts-adapter/lightspeed-agentic-alerts-adapter-ref.metadata.json @@ -0,0 +1,15 @@ +{ + "path": "lightspeed-agentic-alerts-adapter/lightspeed-agentic-alerts-adapter-ref.yaml", + "owners": { + "approvers": [ + "falox", + "rioloc", + "tremes" + ], + "reviewers": [ + "falox", + "rioloc", + "tremes" + ] + } +} \ No newline at end of file diff --git a/ci-operator/step-registry/lightspeed-agentic-alerts-adapter/lightspeed-agentic-alerts-adapter-ref.yaml b/ci-operator/step-registry/lightspeed-agentic-alerts-adapter/lightspeed-agentic-alerts-adapter-ref.yaml new file mode 100644 index 0000000000000..cfe0a8a101fc5 --- /dev/null +++ b/ci-operator/step-registry/lightspeed-agentic-alerts-adapter/lightspeed-agentic-alerts-adapter-ref.yaml @@ -0,0 +1,29 @@ +ref: + as: lightspeed-agentic-alerts-adapter + from: src + cli: latest + commands: lightspeed-agentic-alerts-adapter-commands.sh + timeout: 2h0m0s + grace_period: 60s + resources: + requests: + cpu: 100m + memory: 200Mi + env: + - name: NAMESPACE + default: "openshift-lightspeed" + documentation: "Namespace where lightspeed-agentic-alerts-adapter is deployed." + - name: DEPLOYMENT_NAME + default: "lightspeed-agentic-alerts-adapter" + documentation: "Name of the deployment to wait for." + - name: OPERATOR_NAMESPACE + default: "openshift-lightspeed" + documentation: "Namespace where the lightspeed-agentic-operator is deployed." + dependencies: + - name: "lightspeed-agentic-alerts-adapter" + env: IMAGE + documentation: |- + The lightspeed-agentic-alerts-adapter step deploys lightspeed-agentic-alerts-adapter + from the built image to an OpenShift cluster using hack/deploy-e2e.sh and runs + the E2E test suite with Ginkgo. The deployment script automatically installs + the lightspeed-agentic-operator if needed for the AgenticRun CRD.