Allow to sync tags from admin dashboard (#28045)
Inspired by #28043
This PR adds a option to the Admin Dashboard to sync all tags to the
database.

This commit is contained in:
parent
f3ba3e922d
commit
4567a3a1ad
7 changed files with 100 additions and 0 deletions
|
@ -284,6 +284,22 @@ func CleanUpMigrateInfo(ctx context.Context, repo *repo_model.Repository) (*repo
|
|||
return repo, UpdateRepository(ctx, repo, false)
|
||||
}
|
||||
|
||||
// SyncRepoTags synchronizes releases table with repository tags
|
||||
func SyncRepoTags(ctx context.Context, repoID int64) error {
|
||||
repo, err := repo_model.GetRepositoryByID(ctx, repoID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
gitRepo, err := git.OpenRepository(ctx, repo.RepoPath())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer gitRepo.Close()
|
||||
|
||||
return SyncReleasesWithTags(ctx, repo, gitRepo)
|
||||
}
|
||||
|
||||
// SyncReleasesWithTags synchronizes release table with repository tags
|
||||
func SyncReleasesWithTags(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository) error {
|
||||
log.Debug("SyncReleasesWithTags: in Repo[%d:%s/%s]", repo.ID, repo.OwnerName, repo.Name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue