diff options
| author | Paul Buetow <paul@buetow.org> | 2026-07-22 18:43:11 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-07-22 18:43:11 +0300 |
| commit | 23ecaa2c7f731a4f7188aec2404594641faf2f7f (patch) | |
| tree | 83ac8c3f4d3bfe73a3defc806558eb9db6cded5c /internal/codeberg | |
| parent | ea3b3b2ffc4a1d3c335994e22056a957cd962d21 (diff) | |
fix(sync): make SSH backup repo creation survive non-root pushes and NFS lag
Auditing a full bidirectional sync to the r0 git-server backup destination
showed a stale/missing-repo pattern that cgit idle times alone did not
explain: several public repos (rampage, ggaze, comicforge, fastforge, gonf,
quicklog, shuriken.sh) were entirely absent from r0 even though they synced
fine to GitHub/Codeberg.
Root cause #1: createSSHBareRepository provisions missing backup repos by
running `git init --bare` over a root SSH session directly on the r0
filesystem. That leaves the new repo directory at mode 0755 (root's
session umask), owner-write only. Pushes into it later go through the
git-server pod's own SSH endpoint as a different, non-root UID (1001,
GID 33/www-data per the git-server helm chart's docker-image/Dockerfile),
which then cannot write new objects into the 0755 tree ("unable to create
temporary object directory"). Fixed by initializing with
`git init --bare --shared=group` (mode 2775, matching the already-working
repos on r0).
Root cause #2: even with correct permissions, the push immediately
following repository creation can still fail transiently (the git-server's
own view of the newly created directory can lag behind, e.g. across an NFS
mount). handlePushError treats any backup push failure as fatal for the
remainder of that sync run and disables the backup destination entirely
(disableBackupForSession) - so one transient failure early in a shuffled
repo order silently skipped backup for every repo processed afterward in
that pass, explaining the fuller set of stale repos. Fixed by retrying the
post-creation push up to 3 times with a short backoff in the new
createAndPushSSHBackupRepo helper, and by capturing/propagating the actual
git stderr on failure (previously swallowed via cmd.Run()) so any future
failure is diagnosable instead of a bare "exit status 128".
Verified against the live r0 git-server (ssh://git@r0:30022/repos,
/data/nfs/k3svolumes/git-server/repos): reinstalled gitsyncer and reran
`sync bidirectional --force --backup --auto-create-releases` end to end
with zero backup-disable events across both passes; all previously
missing/broken repos (plus the pre-existing broken player.git and
irregular.ninja.git, repaired directly via chmod) now match GitHub/Codeberg
HEAD exactly and are browsable on c-git.f3s.buetow.org.
Adds a regression test for the --shared=group init command.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'internal/codeberg')
0 files changed, 0 insertions, 0 deletions
