fix(ci): publish reports to ci-reports.dev on runner host
CI / test (push) Successful in 49s
CI / push-image (push) Successful in 1m41s
CI / deploy-ift (push) Successful in 5s
CI / ci-done (push) Successful in 0s
CI / e2e-ift (push) Successful in 19s
CI / deploy-stage (push) Successful in 1m37s
CI / e2e-stage (push) Successful in 21s
CI / test (push) Successful in 49s
CI / push-image (push) Successful in 1m41s
CI / deploy-ift (push) Successful in 5s
CI / ci-done (push) Successful in 0s
CI / e2e-ift (push) Successful in 19s
CI / deploy-stage (push) Successful in 1m37s
CI / e2e-stage (push) Successful in 21s
This commit is contained in:
@@ -30,6 +30,8 @@ env:
|
|||||||
BUILDKIT_PROGRESS: quiet
|
BUILDKIT_PROGRESS: quiet
|
||||||
DOCKER_BUILDKIT: 1
|
DOCKER_BUILDKIT: 1
|
||||||
REGISTRY: git.sabilin.com/eventhub
|
REGISTRY: git.sabilin.com/eventhub
|
||||||
|
CI_REPORTS_BASE_URL: https://ci-reports.dev.eventhub.local
|
||||||
|
RUNNER_STAND: dev
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
|||||||
@@ -16,26 +16,12 @@ REPORTS_DIR="${CI_REPORTS_DIR:-/var/eventhub/ci-reports}"
|
|||||||
STAND="${RUNNER_STAND:-}"
|
STAND="${RUNNER_STAND:-}"
|
||||||
|
|
||||||
detect_stand() {
|
detect_stand() {
|
||||||
if [[ -n "${CI_REPORTS_BASE_URL:-}" ]]; then
|
if [[ -n "${RUNNER_STAND:-}" ]]; then
|
||||||
echo ""
|
echo "${RUNNER_STAND}"
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
if [[ -n "${STAND}" ]]; then
|
|
||||||
echo "${STAND}"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
if getent hosts ci-reports.ift.eventhub.local >/dev/null 2>&1 \
|
|
||||||
|| getent ahostsv4 ci-reports.ift.eventhub.local >/dev/null 2>&1; then
|
|
||||||
# Prefer ift if this host resolves ift reports (IFT runner DNS)
|
|
||||||
if [[ -f /opt/eventhub-ift/.env ]] || [[ -d /opt/eventhub-ift ]]; then
|
|
||||||
echo "ift"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [[ -d /opt/eventhub-ift ]]; then
|
|
||||||
echo "ift"
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
# Gitea runner на dev-машине: отчёты в /var/eventhub/ci-reports локально.
|
||||||
|
# Наличие /opt/eventhub-ift (SSH deploy) не означает, что HTML лежит на IFT-сервере.
|
||||||
echo "dev"
|
echo "dev"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +54,19 @@ ensure_ci_reports_dir() {
|
|||||||
}
|
}
|
||||||
ensure_ci_reports_dir
|
ensure_ci_reports_dir
|
||||||
|
|
||||||
|
ensure_ci_reports_nginx() {
|
||||||
|
command -v docker >/dev/null 2>&1 || return 0
|
||||||
|
local svc replicas
|
||||||
|
svc=$(docker service ls --format '{{.Name}}' 2>/dev/null | grep -E '^eventhub_ci-reports$' | head -n 1 || true)
|
||||||
|
[[ -n "${svc}" ]] || return 0
|
||||||
|
replicas=$(docker service ls --format '{{.Name}} {{.Replicas}}' 2>/dev/null | awk '$1=="eventhub_ci-reports"{print $2; exit}')
|
||||||
|
if [[ "${replicas}" == 0/* ]] || [[ -z "${replicas}" ]]; then
|
||||||
|
echo "Starting ${svc}=1 (dev ci-reports nginx)..."
|
||||||
|
docker service scale "${svc}=1" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
ensure_ci_reports_nginx
|
||||||
|
|
||||||
DEST="${REPORTS_DIR}/${REPO}/${RUN_ID}/${KIND}"
|
DEST="${REPORTS_DIR}/${REPO}/${RUN_ID}/${KIND}"
|
||||||
mkdir -p "${REPORTS_DIR}/${REPO}/${RUN_ID}"
|
mkdir -p "${REPORTS_DIR}/${REPO}/${RUN_ID}"
|
||||||
rm -rf "${DEST}"
|
rm -rf "${DEST}"
|
||||||
@@ -117,6 +116,7 @@ URL="${BASE_URL}/${REPO}/${RUN_ID}/${KIND}/"
|
|||||||
INDEX_URL="${BASE_URL}/${REPO}/${RUN_ID}/"
|
INDEX_URL="${BASE_URL}/${REPO}/${RUN_ID}/"
|
||||||
echo "Report: ${URL}"
|
echo "Report: ${URL}"
|
||||||
echo "Report index: ${INDEX_URL}"
|
echo "Report index: ${INDEX_URL}"
|
||||||
|
echo "Report path: ${DEST}"
|
||||||
if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
|
if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
|
||||||
{
|
{
|
||||||
echo "### Test report"
|
echo "### Test report"
|
||||||
|
|||||||
Reference in New Issue
Block a user