fetch log 개선

This commit is contained in:
Lectom C Han
2025-12-17 09:32:34 +09:00
parent b92f5f6caa
commit cce7c513bc
2 changed files with 23 additions and 5 deletions

View File

@@ -221,7 +221,7 @@ jobs:
target_commit=$(echo "${target_main_ref}" | awk '{print $1}') target_commit=$(echo "${target_main_ref}" | awk '{print $1}')
if [[ -n "${branch_commit:-}" && -n "${target_commit}" && "${branch_commit}" == "${target_commit}" ]]; then if [[ -n "${branch_commit:-}" && -n "${target_commit}" && "${branch_commit}" == "${target_commit}" ]]; then
echo "Target main already at source commit (${branch_commit}). Skipping clone/push." 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 return
fi fi
fi fi
@@ -258,11 +258,28 @@ jobs:
fi fi
echo "Fetching latest branch '${branch_name}' from source..." 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 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" echo "::warning::shallow-exclude fetch failed (likely unsupported). Log: ${FETCH_LOG}"
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 [[ -s "${FETCH_LOG}" ]]; then
if ! git fetch --no-tags source "+refs/heads/${branch_name}:refs/heads/${branch_name}"; 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)" 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 오류(폴백)" notify_status "error" "${repo_name}" "${branch_name}" "${backup_mode}" "${start_epoch}" "source fetch 오류(폴백)"
cd "${ROOT_DIR}" cd "${ROOT_DIR}"

View File

@@ -27,3 +27,4 @@
2025-12-16 18:29:58 KST 추가 업데이트: SEED_FROM_TARGET 옵션과 타겟 main 선-fetch 시드를 제거하고 shallow-exclude 기반 증분 fetch만 유지하여 증분 로직을 단순화. 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: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:35:58 KST 추가 업데이트: 소스 서버가 `--shallow-exclude`를 지원하지 않을 때 타겟 main을 depth=50으로 시드한 후 일반 fetch로 재시도하도록 폴백을 추가, README 동작 개요 반영.
2025-12-17 08:48:00 KST 추가 업데이트: 동일 커밋 건너뛰기 시 모드를 “변경 없음”으로 분리하고 shallow-exclude 실패 시 fetch 로그 tail을 실행 로그에 남기며 폴백 모드를 표시하도록 개선.