Project

Profile

Help

Story #7015

Updated by daviddavis over 4 years ago

Currently there is no way to link a repository with a remote, and as such, each time you wish to sync a repository against it's upstream link, you have to keep a record (or query for) the appropriate remote for that repo. 

 This can be done with careful consideration around naming conventions, however it would be nice if an optional link between a Repository and Remote was possible. 

 As such, once the Repository and Remote have been created an paired, a simply repository sync would be able to work out which remote to use, and sync. 

 ## Design 

 ### Model 

 Add a many-to-many foreign key between Repositories and Remotes. This association should be optional. For now Repositories can only have 0 or 1 remotes. Remotes can belong to any number of repositories. 

 Note: In the future we want to be able to support multiple remotes for repositories that can be synced at once. See https://pulp.plan.io/issues/7031. This is the purpose of having a many-to-many instead of one-to-many. 

 #### REMOTE_TYPES 

 Add an iterable to Repository similar to CONTENT_TYPES. This iterable will check that when a remote is added to a repo, it is of one of these types. 

 ### API 

 #### Repositories 

 Expose a remote hrefs field for repository endpoints. Users should be able to create/read/update this field. Validate that the remote type against `REMOTE_TYPES`. types match between remotes and repositories. Also, indicate in the help text that this field is optional. 

 #### Remotes 

 Expose a repository hrefs field for remote endpoints. Users should be able to view create/read/update this field. Validate that the types match between remotes and repositories. Also, indicate in the help text that this field to see which repos a remote belongs to. is optional. 

 #### Syncing 

 Make the remote parameter on sync optional. If no remote is supplied, the sync task uses locks on all the remote when syncing. repo remotes and the repository itself. It syncs down content from all remotes and generates a new repo version. 

 If a repository does not have any remotes and no remote is supplied, raise an error.

Back