Skip to content

tarball: clean up incomplete repository clones - #1589

Merged
nuclearcat merged 1 commit into
kernelci:mainfrom
nuclearcat:fix-tarball-stale-repo-cleanup
Aug 31, 2026
Merged

tarball: clean up incomplete repository clones#1589
nuclearcat merged 1 commit into
kernelci:mainfrom
nuclearcat:fix-tarball-stale-repo-cleanup

Conversation

@nuclearcat

Copy link
Copy Markdown
Member

When update_repo fails while cloning a repository, Git can leave the destination absent or partially initialized without a .git directory. The current error path treats this state as a safeguard violation and raises an exception, preventing the existing retry logic from attempting a fresh clone. This was observed in production when the media_next remote returned HTTP 502.

Clean up the destination even when it is not yet a Git repository, then return the existing retry signal. Use shutil.rmtree() for directories and unlink symlinks directly instead of invoking rm through a shell. A transient clone failure can now retry from a clean destination rather than terminating the tarball service with a secondary "not a git repo" error.

When update_repo fails while cloning a repository, Git can leave the
destination absent or partially initialized without a .git directory.  The
current error path treats this state as a safeguard violation and raises an
exception, preventing the existing retry logic from attempting a fresh clone.
This was observed in production when the media_next remote returned HTTP 502.

Clean up the destination even when it is not yet a Git repository, then
return the existing retry signal.  Use shutil.rmtree() for directories and
unlink symlinks directly instead of invoking rm through a shell.  A transient
clone failure can now retry from a clean destination rather than terminating
the tarball service with a secondary "not a git repo" error.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
@nuclearcat
nuclearcat added this pull request to the merge queue Aug 31, 2026
Merged via the queue into kernelci:main with commit 5d3f2a1 Aug 31, 2026
5 checks passed
@nuclearcat
nuclearcat deleted the fix-tarball-stale-repo-cleanup branch August 31, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant