Skip to content

Sync LFS objects when push mirroring

Nick Thomas requested to merge 16525-push-mirror-lfs-sync into master

What does this MR do?

When a remote mirror / push mirror is configured, we push git objects to that remote, but LFS objects are skipped. This makes push mirroring a poor solution for projects using LFS.

This MR syncs all the LFS objects in the local repository to the remote after a successful git push.

We do this directly, via the LFS API, instead of adding git lfs to Gitaly, because the latter approach would require us to download the LFS objects to the Gitaly server, and perhaps check out a worktree, to get it working - which seems difficult. In particular, Gitaly wouldn't have credentials to retrieve the LFS objects from object storage.

The LFS upload algorithms and endpoints are not very complex, so touching them directly - in effect, reimplementing some of git lfs - seems reasonable.

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Follow-up issues / MRs

  • Support the 'verify' LFS action
  • Upload LFS objects asynchronously

Part of #16525 (closed)

Edited by Nick Thomas

Merge request reports