Skip to content

fix(private-org-sync): run source and destination ls-remote in parallel#5029

Draft
petr-muller wants to merge 4 commits intoopenshift:mainfrom
petr-muller:git-sync-speedup-6
Draft

fix(private-org-sync): run source and destination ls-remote in parallel#5029
petr-muller wants to merge 4 commits intoopenshift:mainfrom
petr-muller:git-sync-speedup-6

Conversation

@petr-muller
Copy link
Member

@petr-muller petr-muller commented Mar 19, 2026

Runs the source and destination ls-remote --heads calls concurrently using goroutines, since they are independent network operations to different remotes.

Stacked on #5028.

@openshift-ci-robot
Copy link
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@coderabbitai
Copy link

coderabbitai bot commented Mar 19, 2026

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Excluded labels (none allowed) (1)
  • do-not-merge/work-in-progress

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 27414daf-2ffe-40b8-8eef-0dc48c3004ae

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 19, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 19, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 19, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: petr-muller
Once this PR has been reviewed and has the lgtm label, please assign danilo-gemoli for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

…branch

Previously, mirror() called ls-remote for both source and destination
on every branch, resulting in 2*N network calls per repo where N is
the number of branches. Since ls-remote --heads returns ALL branches
at once, we can call it once per repo and pass the results to mirror().

This moves git init, remote setup, and ls-remote calls from mirror()
into the main loop where repos are already grouped, reducing network
calls from 2*N to 2 per repo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
petr-muller and others added 3 commits March 20, 2026 17:20
Extract the per-repo sync logic from main() into a syncRepo method on
gitSyncer. This makes the repo initialization, ls-remote batching, and
branch mirroring flow independently testable.

Add TestSyncRepo with 6 test cases covering: branches in sync, one
branch needing sync, dst/src ls-remote failures (with and without
failOnNonexistentDst), and init failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…errors

Wrap gitExec with withRetryOnTransientError to transparently retry any
git command (fetch, push, ls-remote, etc.) up to 3 times with a
5-second delay when transient network errors are detected (DNS resolution
failures, connection timeouts/refused/reset, server 5xx errors).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Instead of querying source and destination branch heads sequentially,
run both ls-remote calls concurrently using goroutines. This saves one
network round-trip per repo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants