From cce7c513bc11b33102f63c8b47cb4fb313379407 Mon Sep 17 00:00:00 2001 From: Lectom C Han Date: Wed, 17 Dec 2025 09:32:34 +0900 Subject: [PATCH] =?UTF-8?q?fetch=20log=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/mirror.yml | 27 ++++++++++++++++++++++----- to-do.md | 1 + 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/mirror.yml b/.gitea/workflows/mirror.yml index 8441845..6b084ec 100644 --- a/.gitea/workflows/mirror.yml +++ b/.gitea/workflows/mirror.yml @@ -221,7 +221,7 @@ jobs: target_commit=$(echo "${target_main_ref}" | awk '{print $1}') if [[ -n "${branch_commit:-}" && -n "${target_commit}" && "${branch_commit}" == "${target_commit}" ]]; then echo "Target main already at source commit (${branch_commit}). Skipping clone/push." - notify_status "skip" "${repo_name}" "${branch_name}" "${backup_mode}" "${start_epoch}" + notify_status "skip" "${repo_name}" "${branch_name}" "변경 없음 (동일 커밋)" "${start_epoch}" return fi fi @@ -258,11 +258,28 @@ jobs: fi echo "Fetching latest branch '${branch_name}' from source..." - if ! git fetch --no-tags "${shallow_exclude_args[@]}" source "+refs/heads/${branch_name}:refs/heads/${branch_name}"; then + FETCH_LOG="${CLONE_DIR}/fetch_shallow.log" + if ! git fetch --no-tags "${shallow_exclude_args[@]}" source "+refs/heads/${branch_name}:refs/heads/${branch_name}" 2> >(tee "${FETCH_LOG}" >&2); then if [[ "${#shallow_exclude_args[@]}" -gt 0 ]]; then - echo "::warning::shallow-exclude not supported; retrying with target main seed(depth=${TARGET_SEED_DEPTH}) and full fetch" - git fetch --no-tags --depth="${TARGET_SEED_DEPTH}" origin "refs/heads/main:refs/heads/main" || echo "::warning::Seeding from target main skipped (fetch failed or branch missing)" - if ! git fetch --no-tags source "+refs/heads/${branch_name}:refs/heads/${branch_name}"; then + echo "::warning::shallow-exclude fetch failed (likely unsupported). Log: ${FETCH_LOG}" + if [[ -s "${FETCH_LOG}" ]]; then + echo "[shallow-exclude stderr tail]" + tail -n 40 "${FETCH_LOG}" + fi + echo "[fallback] Seeding target main depth=${TARGET_SEED_DEPTH} then retrying full fetch without shallow-exclude" + SEED_LOG="${CLONE_DIR}/fetch_seed.log" + git fetch --no-tags --depth="${TARGET_SEED_DEPTH}" origin "refs/heads/main:refs/heads/main" 2> >(tee "${SEED_LOG}" >&2) || echo "::warning::Seeding from target main skipped (fetch failed or branch missing)" + backup_mode="증분 업데이트 (폴백: shallow-exclude 미지원)" + FULL_FETCH_LOG="${CLONE_DIR}/fetch_full.log" + if ! git fetch --no-tags source "+refs/heads/${branch_name}:refs/heads/${branch_name}" 2> >(tee "${FULL_FETCH_LOG}" >&2); then + if [[ -s "${SEED_LOG:-}" ]]; then + echo "[seed stderr tail]" + tail -n 40 "${SEED_LOG}" + fi + if [[ -s "${FULL_FETCH_LOG}" ]]; then + echo "[fallback fetch stderr tail]" + tail -n 40 "${FULL_FETCH_LOG}" + fi echo "::error::Failed to fetch branch '${branch_name}' from source repo (fallback without shallow-exclude)" notify_status "error" "${repo_name}" "${branch_name}" "${backup_mode}" "${start_epoch}" "source fetch 오류(폴백)" cd "${ROOT_DIR}" diff --git a/to-do.md b/to-do.md index cce67ac..fb91576 100644 --- a/to-do.md +++ b/to-do.md @@ -27,3 +27,4 @@ 2025-12-16 18:29:58 KST 추가 업데이트: SEED_FROM_TARGET 옵션과 타겟 main 선-fetch 시드를 제거하고 shallow-exclude 기반 증분 fetch만 유지하여 증분 로직을 단순화. 2025-12-17 08:27:54 KST 추가 업데이트: 스케줄 cron을 UTC 기준임을 명시하고 02:07 KST 실행을 위해 `7 17 * * *`로 설정, 동기화 결과 요약(총/성공/건너뜀/오류) 메시지를 마지막에 출력하고 알림 웹훅으로 전송하도록 추가. 2025-12-17 08:35:58 KST 추가 업데이트: 소스 서버가 `--shallow-exclude`를 지원하지 않을 때 타겟 main을 depth=50으로 시드한 후 일반 fetch로 재시도하도록 폴백을 추가, README 동작 개요 반영. +2025-12-17 08:48:00 KST 추가 업데이트: 동일 커밋 건너뛰기 시 모드를 “변경 없음”으로 분리하고 shallow-exclude 실패 시 fetch 로그 tail을 실행 로그에 남기며 폴백 모드를 표시하도록 개선.