fix(jd): reconcile code-channel push permissions

This commit is contained in:
冰朔 2026-07-29 23:55:21 +08:00
commit 574d1de23b
2 changed files with 24 additions and 0 deletions

View file

@ -87,6 +87,12 @@ node server-tools/lake-lamp-authz/authorize-repo-push.js \
- 当裸仓库归属代码频道服务账户时,在系统 Git 配置中把该精确路径登记为 - 当裸仓库归属代码频道服务账户时,在系统 Git 配置中把该精确路径登记为
`safe.directory`,不得使用通配符。 `safe.directory`,不得使用通配符。
光湖代码频道本身保留 `UMask=0077`,以免放宽数据库和其他状态目录。仅在
`guanghu-ice-heart.git/hooks/post-receive` 安装仓库随附的
`hooks/guanghu-ice-heart-post-receive`,让成功的公共 Git 推送完成后校正
`objects``refs` 的共享组权限。不要为了共享一个裸仓库而修改整个代码频道服务的
UMask。
部署后用当前主分支生成无变化验收 bundle`receiveBundle` 完整执行一次;验收前后 部署后用当前主分支生成无变化验收 bundle`receiveBundle` 完整执行一次;验收前后
主分支 SHA 必须一致,并且代码频道账户与授权服务账户执行 `git fsck` 均通过。 主分支 SHA 必须一致,并且代码频道账户与授权服务账户执行 `git fsck` 均通过。

View file

@ -0,0 +1,18 @@
#!/bin/sh
set -eu
# The code-channel service runs with UMask=0077. Keep that isolation for its
# database and other state, but make Git objects and refs readable/writable by
# the repository's dedicated shared group after an accepted public push.
repo_dir=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd -P)
cd "$repo_dir"
owner_uid=$(id -u)
find "$repo_dir/objects" "$repo_dir/refs" -user "$owner_uid" -type d -exec chmod g+rwx {} +
find "$repo_dir/objects" "$repo_dir/refs" -user "$owner_uid" -type f -exec chmod g+rw {} +
for shared_file in HEAD packed-refs; do
if [ -f "$repo_dir/$shared_file" ]; then
find "$repo_dir/$shared_file" -user "$owner_uid" -exec chmod g+rw {} +
fi
done