From 3c2c33f83b429e75fbce8bf55898049f91ade483 Mon Sep 17 00:00:00 2001 From: Aleksey Sabilin Date: Tue, 28 Jul 2026 13:52:01 +0300 Subject: [PATCH] feat(ci-reports): publish report.tar.gz archive for offline download Pack HTML report after publish; link archive in run index and CI log. Add fetch-ci-report.sh helper for agent curl/extract. [skip ci] --- docker/ci-reports/nginx.conf | 7 +++++++ scripts/fetch-ci-report.sh | 25 +++++++++++++++++++++++++ scripts/publish-ci-report.sh | 21 ++++++++++++++++++++- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 scripts/fetch-ci-report.sh diff --git a/docker/ci-reports/nginx.conf b/docker/ci-reports/nginx.conf index c7aecd3..82a179d 100644 --- a/docker/ci-reports/nginx.conf +++ b/docker/ci-reports/nginx.conf @@ -5,6 +5,13 @@ server { autoindex on; charset utf-8; + # Archives for curl/agent offline analysis (before Allure SPA fallback) + location ~* \.(tar\.gz|tgz|zip)$ { + default_type application/gzip; + add_header Content-Disposition 'attachment'; + try_files $uri =404; + } + location / { try_files $uri $uri/ =404; } diff --git a/scripts/fetch-ci-report.sh b/scripts/fetch-ci-report.sh new file mode 100644 index 0000000..41fe112 --- /dev/null +++ b/scripts/fetch-ci-report.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# Download CI report archive from ci-reports server and extract for agent/offline analysis. +# Usage: fetch-ci-report.sh [out_dir] +# Example: +# bash scripts/fetch-ci-report.sh \ +# 'https://ci-reports.ift.eventhub.local/EventHubFront/40/allure-ift/report.tar.gz' \ +# ./.tmp-ci-report +set -euo pipefail + +URL="${1:?report.tar.gz URL}" +OUT="${2:-./ci-report-archive}" +CURL=(curl -fsSL) +if [[ "${CI_REPORTS_INSECURE:-}" == "1" ]]; then + CURL+=( -k ) +fi + +mkdir -p "${OUT}" +ARCHIVE="${OUT}/report.tar.gz" +"${CURL[@]}" "${URL}" -o "${ARCHIVE}" +rm -rf "${OUT}/contents" +mkdir -p "${OUT}/contents" +tar -xzf "${ARCHIVE}" -C "${OUT}/contents" +echo "Archive: ${ARCHIVE}" +echo "Extracted: ${OUT}/contents" +echo "Allure index (if present): ${OUT}/contents/index.html" diff --git a/scripts/publish-ci-report.sh b/scripts/publish-ci-report.sh index 1961859..c718f4f 100644 --- a/scripts/publish-ci-report.sh +++ b/scripts/publish-ci-report.sh @@ -92,6 +92,16 @@ rm -rf "${DEST}" mkdir -p "${DEST}" cp -a "${SRC}/." "${DEST}/" +create_report_archive() { + local dest="$1" + local archive="${dest}/report.tar.gz" + local tmp + tmp="$(mktemp)" + tar -czf "${tmp}" -C "${dest}" . + mv -f "${tmp}" "${archive}" +} +create_report_archive "${DEST}" + # Convenience: CT puts index under ct_run.*; expose DEST/index.html if [[ ! -f "${DEST}/index.html" ]]; then CT_INDEX="$(find "${DEST}" -type f -name index.html 2>/dev/null | head -n 1 || true)" @@ -123,7 +133,13 @@ INDEX="${REPORTS_DIR}/${REPO}/${RUN_ID}/index.html" [[ -d "${d}" ]] || continue name="$(basename "${d}")" if [[ -f "${d}index.html" ]]; then - echo "
  • ${name}
  • " + if [[ -f "${d}report.tar.gz" ]]; then + echo "
  • ${name}report.tar.gz
  • " + else + echo "
  • ${name}
  • " + fi + elif [[ -f "${d}report.tar.gz" ]]; then + echo "
  • ${name}/report.tar.gz
  • " else echo "
  • ${name}/
  • " fi @@ -132,15 +148,18 @@ INDEX="${REPORTS_DIR}/${REPO}/${RUN_ID}/index.html" } > "${INDEX}" URL="${BASE_URL}/${REPO}/${RUN_ID}/${KIND}/" +ARCHIVE_URL="${BASE_URL}/${REPO}/${RUN_ID}/${KIND}/report.tar.gz" INDEX_URL="${BASE_URL}/${REPO}/${RUN_ID}/" echo "Report stand: ${STAND}" echo "Report: ${URL}" +echo "Report archive: ${ARCHIVE_URL}" echo "Report index: ${INDEX_URL}" echo "Report path: ${DEST}" if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then { echo "### Test report" echo "- [${KIND}](${URL})" + echo "- [${KIND} archive](${ARCHIVE_URL})" echo "- [index](${INDEX_URL})" } >> "${GITHUB_STEP_SUMMARY}" fi