diff --git a/ci-operator/step-registry/openshift/microshift/e2e/metal-tests/openshift-microshift-e2e-metal-tests-workflow.yaml b/ci-operator/step-registry/openshift/microshift/e2e/metal-tests/openshift-microshift-e2e-metal-tests-workflow.yaml index 394a914d7dddf..160152638fd4c 100644 --- a/ci-operator/step-registry/openshift/microshift/e2e/metal-tests/openshift-microshift-e2e-metal-tests-workflow.yaml +++ b/ci-operator/step-registry/openshift/microshift/e2e/metal-tests/openshift-microshift-e2e-metal-tests-workflow.yaml @@ -9,6 +9,7 @@ workflow: test: - ref: openshift-microshift-e2e-metal-tests post: + - ref: openshift-microshift-infra-pcp-dashboard - ref: openshift-microshift-infra-pmlogs - ref: openshift-microshift-infra-sos-aws - ref: openshift-microshift-infra-aws-deprovision diff --git a/ci-operator/step-registry/openshift/microshift/infra/pcp-dashboard/OWNERS b/ci-operator/step-registry/openshift/microshift/infra/pcp-dashboard/OWNERS new file mode 100644 index 0000000000000..f427ff70caa0a --- /dev/null +++ b/ci-operator/step-registry/openshift/microshift/infra/pcp-dashboard/OWNERS @@ -0,0 +1,5 @@ +approvers: +- openshift-edge-approvers +options: {} +reviewers: +- openshift-edge-reviewers diff --git a/ci-operator/step-registry/openshift/microshift/infra/pcp-dashboard/openshift-microshift-infra-pcp-dashboard-commands.sh b/ci-operator/step-registry/openshift/microshift/infra/pcp-dashboard/openshift-microshift-infra-pcp-dashboard-commands.sh new file mode 100644 index 0000000000000..db601c6b6c021 --- /dev/null +++ b/ci-operator/step-registry/openshift/microshift/infra/pcp-dashboard/openshift-microshift-infra-pcp-dashboard-commands.sh @@ -0,0 +1,52 @@ +#!/bin/bash +set -xeuo pipefail + +# shellcheck disable=SC1091 +source "${SHARED_DIR}/ci-functions.sh" +ci_script_prologue +trap_subprocesses_on_term + +EDGE_TOOLING_DIR="${EDGE_TOOLING_DIR:-/opt/app-root/src/edge-tooling}" +PCP_SCRIPTS="${EDGE_TOOLING_DIR}/plugins/microshift-ci/scripts/pcp-graphs" +LOCAL_ARTIFACTS=$(mktemp -d) + +# Construct GCS path to the metal-tests step's scenario-info. +# The metal-tests step uploads scenario-info (including pcp-archives.tar) to GCS, +# but these files are no longer on the hypervisor by the time this post step runs. +if [ "${JOB_TYPE}" == "presubmit" ]; then + GCS_JOB_PATH="pr-logs/pull/${REPO_OWNER}_${REPO_NAME}/${PULL_NUMBER}/${JOB_NAME}/${BUILD_ID}" +else + GCS_JOB_PATH="logs/${JOB_NAME}/${BUILD_ID}" +fi +GCS_BASE="gs://test-platform-results/${GCS_JOB_PATH}" + +# Find scenario-info path (wildcard handles different workflow names) +SCENARIO_GCS=$(gsutil ls -d "${GCS_BASE}/artifacts/*/openshift-microshift-e2e-metal-tests/artifacts/scenario-info/" 2>/dev/null | head -1 || true) + +if [ -n "${SCENARIO_GCS}" ]; then + echo "Downloading VM PCP archives from GCS..." + while IFS= read -r gcs_file; do + rel="${gcs_file#"${SCENARIO_GCS}"}" + mkdir -p "${LOCAL_ARTIFACTS}/$(dirname "${rel}")" + gsutil -q cp "${gcs_file}" "${LOCAL_ARTIFACTS}/${rel}" + done < <(gsutil ls -r "${SCENARIO_GCS}" 2>/dev/null | grep -E '(pcp-archives\.tar|junit\.xml)$') +else + echo "WARNING: could not find scenario-info in GCS at ${GCS_BASE}" +fi + +# Copy hypervisor PCP logs if available +PMLOGS_DIR=/var/log/pcp/pmlogger +if ssh "${INSTANCE_PREFIX}" "[ -d \"${PMLOGS_DIR}\" ]" ; then + mkdir -p "${LOCAL_ARTIFACTS}/pmlogs" + if ! scp -r "${INSTANCE_PREFIX}:${PMLOGS_DIR}/"* "${LOCAL_ARTIFACTS}/pmlogs/" ; then + echo "WARNING: failed to copy hypervisor pmlogger data, skipping" + fi +fi + +# Generate the interactive PCP dashboard +echo "Generating PCP dashboard..." +bash "${PCP_SCRIPTS}/generate-dashboard.sh" \ + --local "${LOCAL_ARTIFACTS}" \ + --output "${ARTIFACT_DIR}/custom-link-pcp.html" + +rm -rf "${LOCAL_ARTIFACTS}" diff --git a/ci-operator/step-registry/openshift/microshift/infra/pcp-dashboard/openshift-microshift-infra-pcp-dashboard-ref.metadata.json b/ci-operator/step-registry/openshift/microshift/infra/pcp-dashboard/openshift-microshift-infra-pcp-dashboard-ref.metadata.json new file mode 100644 index 0000000000000..665dd8399a7d7 --- /dev/null +++ b/ci-operator/step-registry/openshift/microshift/infra/pcp-dashboard/openshift-microshift-infra-pcp-dashboard-ref.metadata.json @@ -0,0 +1,11 @@ +{ + "path": "openshift/microshift/infra/pcp-dashboard/openshift-microshift-infra-pcp-dashboard-ref.yaml", + "owners": { + "approvers": [ + "openshift-edge-approvers" + ], + "reviewers": [ + "openshift-edge-reviewers" + ] + } +} \ No newline at end of file diff --git a/ci-operator/step-registry/openshift/microshift/infra/pcp-dashboard/openshift-microshift-infra-pcp-dashboard-ref.yaml b/ci-operator/step-registry/openshift/microshift/infra/pcp-dashboard/openshift-microshift-infra-pcp-dashboard-ref.yaml new file mode 100644 index 0000000000000..71237bf10ed3e --- /dev/null +++ b/ci-operator/step-registry/openshift/microshift/infra/pcp-dashboard/openshift-microshift-infra-pcp-dashboard-ref.yaml @@ -0,0 +1,25 @@ +ref: + as: openshift-microshift-infra-pcp-dashboard + from_image: + namespace: ci + name: edge-tooling-ai-helpers + tag: latest + commands: openshift-microshift-infra-pcp-dashboard-commands.sh + resources: + requests: + cpu: 100m + memory: 200Mi + timeout: 15m + grace_period: 10m + best_effort: true + env: + - name: HOME + default: /tmp/secret + credentials: + - namespace: test-credentials + name: microshift-rhsm-creds + mount_path: /var/run/rhsm/ + documentation: |- + Generates an interactive PCP performance dashboard from scenario VM and + hypervisor PCP archives, producing a custom-link-pcp.html artifact that + Spyglass renders as a "Test PCP" toggle in Prow job results.