From c029f80f8f6f37a19ea7311ef536efd1f7380937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbyn=C4=9Bk=20Dr=C3=A1pela?= Date: Wed, 1 Jul 2026 10:57:26 +0200 Subject: [PATCH] ci: gzip junit results in SHARED_DIR to avoid Secret size limit Gzip junit XML before writing to SHARED_DIR to stay under the Kubernetes Secret 1 MiB size limit. Raw junit XML can exceed this when coverage tags and many test cases are present. XML compresses ~10-15x with gzip, keeping even large files well under the limit. Also adds a safety check that removes the gzipped file if it still exceeds 800 KB after compression, and validates the source file exists before attempting the copy. The data-router step in openshift/release already handles both .gz and plain .xml formats (openshift/release#81313). Assisted-by: OpenCode --- .ci/pipelines/lib/testing.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.ci/pipelines/lib/testing.sh b/.ci/pipelines/lib/testing.sh index 55faffe792..70725f798e 100644 --- a/.ci/pipelines/lib/testing.sh +++ b/.ci/pipelines/lib/testing.sh @@ -107,8 +107,18 @@ testing::run_tests() { # Use artifacts_subdir for artifact directory to keep artifacts organized common::save_artifact "${artifacts_subdir}" "${e2e_tests_dir}/test-results/" "test-results" || true common::save_artifact "${artifacts_subdir}" "${e2e_tests_dir}/${JUNIT_RESULTS}" || true - if [[ "${CI}" == "true" ]]; then - rsync "${ARTIFACT_DIR}/${artifacts_subdir}/${JUNIT_RESULTS}" "${SHARED_DIR}/junit-results-${artifacts_subdir}.xml" || true + if [[ "${CI}" == "true" && -f "${ARTIFACT_DIR}/${artifacts_subdir}/${JUNIT_RESULTS}" ]]; then + # Gzip junit before writing to SHARED_DIR to stay under Kubernetes Secret 1 MiB limit + gzip -c "${ARTIFACT_DIR}/${artifacts_subdir}/${JUNIT_RESULTS}" > "${SHARED_DIR}/junit-results-${artifacts_subdir}.xml.gz" + local gz_size + gz_size=$(stat -c%s "${SHARED_DIR}/junit-results-${artifacts_subdir}.xml.gz" 2> /dev/null || stat -f%z "${SHARED_DIR}/junit-results-${artifacts_subdir}.xml.gz") + local max_size=$((800 * 1024)) + if ((gz_size > max_size)); then + echo "[WARNING] junit-results-${artifacts_subdir}.xml.gz is $((gz_size / 1024)) KB, exceeds $((max_size / 1024)) KB limit. Removing from SHARED_DIR." + rm -f "${SHARED_DIR}/junit-results-${artifacts_subdir}.xml.gz" + else + echo "[INFO] Copied junit-results-${artifacts_subdir}.xml.gz to SHARED_DIR ($((gz_size / 1024)) KB)" + fi fi common::save_artifact "${artifacts_subdir}" "${e2e_tests_dir}/screenshots/" "attachments/screenshots" || true