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]
This commit is contained in:
@@ -5,6 +5,13 @@ server {
|
|||||||
autoindex on;
|
autoindex on;
|
||||||
charset utf-8;
|
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 / {
|
location / {
|
||||||
try_files $uri $uri/ =404;
|
try_files $uri $uri/ =404;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 <report.tar.gz URL> [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"
|
||||||
@@ -92,6 +92,16 @@ rm -rf "${DEST}"
|
|||||||
mkdir -p "${DEST}"
|
mkdir -p "${DEST}"
|
||||||
cp -a "${SRC}/." "${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
|
# Convenience: CT puts index under ct_run.*; expose DEST/index.html
|
||||||
if [[ ! -f "${DEST}/index.html" ]]; then
|
if [[ ! -f "${DEST}/index.html" ]]; then
|
||||||
CT_INDEX="$(find "${DEST}" -type f -name index.html 2>/dev/null | head -n 1 || true)"
|
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
|
[[ -d "${d}" ]] || continue
|
||||||
name="$(basename "${d}")"
|
name="$(basename "${d}")"
|
||||||
if [[ -f "${d}index.html" ]]; then
|
if [[ -f "${d}index.html" ]]; then
|
||||||
echo "<li><a href=\"./${name}/index.html\">${name}</a></li>"
|
if [[ -f "${d}report.tar.gz" ]]; then
|
||||||
|
echo "<li><a href=\"./${name}/index.html\">${name}</a> — <a href=\"./${name}/report.tar.gz\">report.tar.gz</a></li>"
|
||||||
|
else
|
||||||
|
echo "<li><a href=\"./${name}/index.html\">${name}</a></li>"
|
||||||
|
fi
|
||||||
|
elif [[ -f "${d}report.tar.gz" ]]; then
|
||||||
|
echo "<li><a href=\"./${name}/\">${name}/</a> — <a href=\"./${name}/report.tar.gz\">report.tar.gz</a></li>"
|
||||||
else
|
else
|
||||||
echo "<li><a href=\"./${name}/\">${name}/</a></li>"
|
echo "<li><a href=\"./${name}/\">${name}/</a></li>"
|
||||||
fi
|
fi
|
||||||
@@ -132,15 +148,18 @@ INDEX="${REPORTS_DIR}/${REPO}/${RUN_ID}/index.html"
|
|||||||
} > "${INDEX}"
|
} > "${INDEX}"
|
||||||
|
|
||||||
URL="${BASE_URL}/${REPO}/${RUN_ID}/${KIND}/"
|
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}/"
|
INDEX_URL="${BASE_URL}/${REPO}/${RUN_ID}/"
|
||||||
echo "Report stand: ${STAND}"
|
echo "Report stand: ${STAND}"
|
||||||
echo "Report: ${URL}"
|
echo "Report: ${URL}"
|
||||||
|
echo "Report archive: ${ARCHIVE_URL}"
|
||||||
echo "Report index: ${INDEX_URL}"
|
echo "Report index: ${INDEX_URL}"
|
||||||
echo "Report path: ${DEST}"
|
echo "Report path: ${DEST}"
|
||||||
if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
|
if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
|
||||||
{
|
{
|
||||||
echo "### Test report"
|
echo "### Test report"
|
||||||
echo "- [${KIND}](${URL})"
|
echo "- [${KIND}](${URL})"
|
||||||
|
echo "- [${KIND} archive](${ARCHIVE_URL})"
|
||||||
echo "- [index](${INDEX_URL})"
|
echo "- [index](${INDEX_URL})"
|
||||||
} >> "${GITHUB_STEP_SUMMARY}"
|
} >> "${GITHUB_STEP_SUMMARY}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user