증분백업 로직 개선, shallow_exclude 옵션 활용.
This commit is contained in:
@@ -13,7 +13,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
mirror:
|
mirror:
|
||||||
runs-on: [internal]
|
runs-on: [internal]
|
||||||
timeout-minutes: 360 # 6 hours timeout
|
timeout-minutes: 500
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -216,6 +216,10 @@ jobs:
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
shallow_exclude_args=()
|
||||||
|
if ${repo_exists} && [[ -n "${target_commit:-}" ]]; then
|
||||||
|
shallow_exclude_args=(--shallow-exclude="${target_commit}")
|
||||||
|
fi
|
||||||
|
|
||||||
# Create a temporary directory for cloning
|
# Create a temporary directory for cloning
|
||||||
CLONE_DIR=$(mktemp -d)
|
CLONE_DIR=$(mktemp -d)
|
||||||
@@ -242,14 +246,10 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
git remote add origin "${GITEA_REMOTE}"
|
git remote add origin "${GITEA_REMOTE}"
|
||||||
git remote add source "${source_repo_url}"
|
git remote add source "${source_repo_url}"
|
||||||
echo "Seeding objects from target main for delta fetch..."
|
|
||||||
if ! git fetch --no-tags origin "+refs/heads/main:refs/heads/main"; then
|
|
||||||
echo "::warning::Failed to fetch target main; continuing without seed"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Fetching latest branch '${branch_name}' from source..."
|
echo "Fetching latest branch '${branch_name}' from source..."
|
||||||
if ! git fetch --no-tags source "+refs/heads/${branch_name}:refs/heads/${branch_name}"; then
|
if ! git fetch --no-tags "${shallow_exclude_args[@]}" source "+refs/heads/${branch_name}:refs/heads/${branch_name}"; then
|
||||||
echo "::error::Failed to fetch branch '${branch_name}' from source repo"
|
echo "::error::Failed to fetch branch '${branch_name}' from source repo"
|
||||||
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}"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
- 브랜치마다 대응 저장소명을 결정해 `main` 브랜치로 강제 푸시하며, 태그 동기화 옵션을 제공합니다.
|
- 브랜치마다 대응 저장소명을 결정해 `main` 브랜치로 강제 푸시하며, 태그 동기화 옵션을 제공합니다.
|
||||||
|
|
||||||
## 실행 환경
|
## 실행 환경
|
||||||
- Runner 라벨: `internal` (워크플로우는 이 라벨을 가진 러너에서만 동작)
|
- Runner 라벨: `internal` (해당 라벨이 있는 셀프호스티드 러너에서만 실행)
|
||||||
- 예약 실행: 매일 02:07 KST (`cron: 7 2 * * *`)
|
- 예약 실행: 매일 02:07 KST (`cron: 7 2 * * *`)
|
||||||
- 수동 실행: `workflow_dispatch` 입력을 통해 선택 브랜치만 실행 가능
|
- 수동 실행: `workflow_dispatch` 입력을 통해 선택 브랜치만 실행 가능
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
2) 타겟 저장소 존재 확인/생성 (`default_branch=main`)
|
2) 타겟 저장소 존재 확인/생성 (`default_branch=main`)
|
||||||
3) 커밋 동일 시 skip (알림 전송)
|
3) 커밋 동일 시 skip (알림 전송)
|
||||||
4) 신규 생성: 소스 브랜치를 bare single-branch clone 후 `main`으로 강제 푸시
|
4) 신규 생성: 소스 브랜치를 bare single-branch clone 후 `main`으로 강제 푸시
|
||||||
5) 기존 존재: 빈 bare 저장소 init → 타겟 `main` 선-fetch로 객체 시드 → 소스 브랜치만 fetch → `main`으로 강제 푸시
|
5) 기존 존재: 빈 bare 저장소 init → 타겟 `main` 커밋을 shallow-exclude로 지정해 소스 브랜치만 fetch → `main`으로 강제 푸시
|
||||||
6) 태그 동기화가 켜져 있으면 태그 fetch/push(강제+prune)
|
6) 태그 동기화가 켜져 있으면 태그 fetch/push(강제+prune)
|
||||||
7) 기본 브랜치를 `main`으로 패치, 임시 디렉터리 정리
|
7) 기본 브랜치를 `main`으로 패치, 임시 디렉터리 정리
|
||||||
|
|
||||||
|
|||||||
5
to-do.md
5
to-do.md
@@ -20,3 +20,8 @@
|
|||||||
2025-12-16 13:28:01 KST 추가 업데이트: mirror.yml에 branch_list 주석(`#`) 스킵 및 `sourceRepo/branch,alias` 구문을 추가해, 콤마 뒤의 별도 저장소 이름(alias)으로 타겟을 지정할 수 있도록 개선.
|
2025-12-16 13:28:01 KST 추가 업데이트: mirror.yml에 branch_list 주석(`#`) 스킵 및 `sourceRepo/branch,alias` 구문을 추가해, 콤마 뒤의 별도 저장소 이름(alias)으로 타겟을 지정할 수 있도록 개선.
|
||||||
2025-12-16 14:03:18 KST 추가 업데이트: mirror.yml에 태그 동기화 옵션(SYNC_TAGS, 기본 true) 추가. 소스 태그를 fetch --prune/--prune-tags 후 타겟으로 push --force --prune해 태그를 미러링하도록 개선하며, 태그 동기화 실패 시 알림을 보냄.
|
2025-12-16 14:03:18 KST 추가 업데이트: mirror.yml에 태그 동기화 옵션(SYNC_TAGS, 기본 true) 추가. 소스 태그를 fetch --prune/--prune-tags 후 타겟으로 push --force --prune해 태그를 미러링하도록 개선하며, 태그 동기화 실패 시 알림을 보냄.
|
||||||
2025-12-16 16:16:39 KST 추가 업데이트: README.md 작성(목적/사용법/입력 규칙/시크릿/러너 조건/태그 옵션 등). mirror.yml의 cron을 매일 02:07 KST로 조정하고 runs-on 라벨을 `internal`로 제한.
|
2025-12-16 16:16:39 KST 추가 업데이트: README.md 작성(목적/사용법/입력 규칙/시크릿/러너 조건/태그 옵션 등). mirror.yml의 cron을 매일 02:07 KST로 조정하고 runs-on 라벨을 `internal`로 제한.
|
||||||
|
2025-12-16 17:59:05 KST 추가 업데이트: mirror.yml에 runner_label 입력 및 RUNNER_LABEL 변수 기반 실행러너 선택 로직 추가(없으면 ubuntu-latest 사용), README에 러너 지정 방법 반영.
|
||||||
|
2025-12-16 18:10:22 KST 추가 업데이트: runner 설정을 다시 `runs-on: [internal]`로 고정한 상태에 맞춰 README 실행 환경 설명을 internal 러너 기준으로 롤백 정리.
|
||||||
|
2025-12-16 18:16:34 KST 추가 업데이트: 증분 성능 검토를 위해 타겟 main 선-fetch를 켜고 끄기 위한 SEED_FROM_TARGET 옵션(기본 false) 추가. README에 옵션 설명 반영.
|
||||||
|
2025-12-16 18:20:26 KST 추가 업데이트: 증분 fetch 시 타겟 main 커밋을 shallow-exclude로 지정해 필요한 부분만 받아오도록 변경, README 동작 개요에 반영.
|
||||||
|
2025-12-16 18:29:58 KST 추가 업데이트: SEED_FROM_TARGET 옵션과 타겟 main 선-fetch 시드를 제거하고 shallow-exclude 기반 증분 fetch만 유지하여 증분 로직을 단순화.
|
||||||
|
|||||||
Reference in New Issue
Block a user