fix: 总纲去除过时的「四个里」计数(YAML+文章源),mirror_sync 增 --blobless 与克隆重试加固

- data/projects/*.yaml:maka/openclaw/openwork 的 positioning 文案去掉样本计数比较级
  (扩到 7 样本后「四个里唯一…」已不成立或表述失真),改事实陈述
- articles/00-overview.md(id=98 源):同步 4 处,已重发线上覆盖
- scripts/mirror_sync.sh:新增 --blobless(--filter=blob:none 懒拉 blob,大仓可省 10x 传输);
  克隆重试 3→8 次且退避 10→80s,抗沙箱代理 502 抖动
This commit is contained in:
gitea-publish
2026-09-02 01:44:08 +08:00
parent ec9b234936
commit 87dc8f78fa
5 changed files with 26 additions and 14 deletions
+16 -4
View File
@@ -4,6 +4,7 @@
# 用法:
# bash scripts/mirror_sync.sh --id ipollowork
# bash scripts/mirror_sync.sh --id ipollowork --depth 200 # 超大仓只取近期历史
# bash scripts/mirror_sync.sh --id orca --blobless # 大仓懒拉 blob,只走源码快照
#
# 可见性由档案的 business.license.redistributable 决定(L1/L2 → public,L3 → private)。
# 这条规则不能手工绕过:把 source-available 项目公开镜像,等于替对方做了一次
@@ -26,6 +27,10 @@ SET_PUBLIC="0"
EXCLUDE_COUNT="0"
# 跳过上游更新(本地裸仓已完整,只为重做快照时用)
NO_FETCH="0"
# blobless 克隆:--filter=blob:none,初始只拉 commits+trees,checkout 时按需懒拉 blob。
# 大仓(尤其 blob 占比高)可把传输量从整包几百 MB 砍到几十 MB,且具备"克隆成功即落盘、
# 之后懒拉 blob 失败可重跑续传"的容错;代价是只能走源码快照(partial clone 不能按 mirror 推送)。
BLOBLESS="0"
while [[ $# -gt 0 ]]; do
case "$1" in
@@ -36,6 +41,7 @@ while [[ $# -gt 0 ]]; do
--no-source-only) SOURCE_ONLY="no"; shift;;
--set-public) SET_PUBLIC="1"; shift;;
--no-fetch) NO_FETCH="1"; shift;;
--blobless) BLOBLESS="1"; shift;;
*) echo "未知参数: $1" >&2; exit 1;;
esac
done
@@ -232,19 +238,23 @@ else
# 失败不保留已下载内容,所以首次克隆必须带重试。
CLONE_ARGS=(clone --mirror)
[[ -n "${DEPTH}" ]] && CLONE_ARGS+=(--depth "${DEPTH}")
[[ "${BLOBLESS}" == "1" ]] && CLONE_ARGS+=(--filter=blob:none)
if [[ -n "${DEPTH}" ]]; then
echo " 首次镜像(--depth ${DEPTH},只取近期历史)..."
else
echo " 首次全量镜像(大仓请耐心)..."
fi
for attempt in 1 2 3; do
# 沙箱代理对 GitHub 偶发 502(CONNECT tunnel failed),且大仓传输动辄几小时,
# 一次 502 就可能断在半途。所以克隆重试要够多、退避够长:8 次、10→80s 递增。
# blobless 模式下"克隆成功即落盘"还能在 checkout 阶段继续容错(见下)。
for attempt in $(seq 1 8); do
if git "${CLONE_ARGS[@]}" "${UPSTREAM}" "${MIRROR_DIR}"; then
break
fi
echo " ⚠ 第 ${attempt} 次克隆失败,8s 后重试 ..."
echo " ⚠ 第 ${attempt} 次克隆失败,$(( attempt * 10 ))s 后重试 ..."
rm -rf "${MIRROR_DIR}"
sleep 8
[[ ${attempt} -eq 3 ]] && { echo "克隆三次均失败,请检查网络/代理" >&2; exit 1; }
sleep $(( attempt * 10 ))
[[ ${attempt} -eq 8 ]] && { echo "克隆八次均失败,请检查网络/代理" >&2; exit 1; }
done
fi
@@ -287,6 +297,8 @@ P_ENC="$(/Users/figmarlite/.workbuddy/binaries/python/envs/default/bin/python -c
MAX_PUSH_MB="${MAX_PUSH_MB:-45}"
PACK_KB="$(git -C "${MIRROR_DIR}" count-objects -v | awk '/^size-pack:/{print $2}')"
PACK_MB=$(( PACK_KB / 1024 ))
# blobless 镜像只能走源码快照:partial clone 不能按 mirror 推送。
[[ "${BLOBLESS}" == "1" ]] && SOURCE_ONLY_FORCE="yes"
MIRROR_MODE="full"
echo " 本地裸仓打包体积: ${PACK_MB} MB(推送上限 ${MAX_PUSH_MB} MB)"