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}')
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}"