Skip to content

Stop creating destination repository for ReplicateRepository

What does this MR do?

Noticed while investigating gitaly#2837 (closed)

ReplicateRepository actually creates the destination repository for us if it does not exist. When it does, it uses a more efficient snapshot transfer instead of only a git fetch.

As of gitaly!2320 (merged) relying on ReplicateRepository to create a repository using GetSnapshot should result in a consistent repository.

Manual Testing

Assuming we have gitaly setup with a second storage called second stored in ~/Downloads/second/.

Check where the project is currently stored:

$ curl -H "PRIVATE_TOKEN: XXXX" http://localhost:3000/api/v4/projects/23
{"id":23, ... "repository_storage":"default", ...}

Make sure the second storage has nothing in it:

rm -rf ~/Downloads/second/*

Initiate the move:

$ curl -X PUT -H "PRIVATE_TOKEN: XXXX" -H "Content-Type: application/json" -d '{"repository_storage":"second"}' http://localhost:3000/api/v4/projects/23
{"id":23, ...}

Wait for the transfer to happen:

$ curl -H "PRIVATE_TOKEN: XXXX" http://localhost:3000/api/v4/projects/23
{"id":23, ... "repository_storage":"second", ...}

Double check everything was created in the storage dir:

$ ls ~/Downloads/second/
+gitaly @hashed

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
Edited by James Fargher

Merge request reports