Skip to content

gitserver: add GitserverReplicator worker

Administrator requested to merge as/add-localclone-worker into main

Created by: asdine

This adds a new background job to the worker service. This job reads rows from the gitserver_localclone_jobs table and clones repos from one gitserver instance to another. Optionally, it deletes the source repository after successful copy. This job will be used to migrate repos asynchronously between gitserver instances without contacting the code host.

Highlights

  • The worker is implemented using the workerutil package. This PR contains mostly code that complies with the expected interfaces and database structure.
  • I added a new package in cmd/gitserver/background which will contain all the background jobs we want to run in the worker service. This is to mimic most of the existing job implementations.

Test plan

  • Unit test
  • Run sg with double gitservers and insert rows in the gitserver_localclone_jobs table. Tested with and without deletion.

Fixes #32827

Merge request reports

Loading