Skip to content

EPMDEDP-17251: fix: Replace clone-based CodebaseBranch git operations with packless transport - #305

Merged
SergK merged 1 commit into
masterfrom
feature/EPMDEDP-17251-packless-codebasebranch
Aug 3, 2026
Merged

EPMDEDP-17251: fix: Replace clone-based CodebaseBranch git operations with packless transport#305
SergK merged 1 commit into
masterfrom
feature/EPMDEDP-17251-packless-codebasebranch

Conversation

@SergK

@SergK SergK commented Aug 3, 2026

Copy link
Copy Markdown
Member

Branch reconciliation cloned the entire repository per CodebaseBranch only to validate a reference and push a branch pointer. The two-step clone was not atomic: a transient network failure between clone and fetch left a half-initialized workdir cache that later reconciles trusted forever, permanently failing the CR until manual intervention. go-git clone is also documented to exhaust memory on large repositories.

  • resolve references through the upload-pack advertisement (ls-remote equivalent): branch, tag with peeled hash, HEAD, or full commit hash, bounded by ref count instead of repository size
  • create remote branches with a receive-pack reference update carrying an empty packfile, the mechanism the git pack protocol mandates when the server already owns the target object
  • resolve fromRef via upload-pack because receive-pack advertisements omit peeled tag hashes and a branch must point at the peeled commit, not the tag object
  • fall back to the codebase default branch for an empty fromCommit, since receive-pack advertises no HEAD symref
  • drop workdir management from the branch chain and remove the superseded clone-based methods

Each reconcile attempt is now self-contained: nothing to poison between retries, branches pushed after CR creation are found on the next attempt, and per-branch disk usage is zero.

@SergK
SergK requested a review from a team as a code owner August 3, 2026 19:15
… with packless transport

Branch reconciliation cloned the entire repository per CodebaseBranch only to validate a reference
and push a branch pointer. The two-step clone was not atomic: a transient network failure between
clone and fetch left a half-initialized workdir cache that later reconciles trusted forever,
permanently failing the CR until manual intervention. go-git clone is also documented to exhaust
memory on large repositories.

- resolve references through the upload-pack advertisement (ls-remote equivalent): branch, tag with
  peeled hash, HEAD, or full commit hash, bounded by ref count instead of repository size
- create remote branches with a receive-pack reference update carrying an empty packfile, the
  mechanism the git pack protocol mandates when the server already owns the target object
- resolve fromRef via upload-pack because receive-pack advertisements omit peeled tag hashes and a
  branch must point at the peeled commit, not the tag object
- fall back to the codebase default branch for an empty fromCommit, since receive-pack advertises
  no HEAD symref
- drop workdir management from the branch chain and remove the superseded clone-based methods

Each reconcile attempt is now self-contained: nothing to poison between retries, branches pushed
after CR creation are found on the next attempt, and per-branch disk usage is zero.

Signed-off-by: Sergiy Kulanov <sergiy_kulanov@epam.com>
@SergK
SergK force-pushed the feature/EPMDEDP-17251-packless-codebasebranch branch from a27b2c9 to cbf7e66 Compare August 3, 2026 19:19
@epmd-edp

epmd-edp commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Pipeline review-codebase-operator-master-b8b4r ✅ Passed

Status Task Duration
github-set-pending-status 7s
fetch-repository 11s
init-values 5s
get-cache 2m3s
commit-validate 5s
dockerfile-lint 8s
helm-lint 6s
helm-docs 10s
build 47s
sonar 16s
save-cache 7s
buildkit-build 29s
github-report-pipeline-status 6s

@SergK
SergK merged commit 30d0e77 into master Aug 3, 2026
6 checks passed
@SergK
SergK deleted the feature/EPMDEDP-17251-packless-codebasebranch branch August 3, 2026 19:26
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.

2 participants