Gitea remote support

This commit is contained in:
Ryan McGuire 2024-01-16 15:56:22 -05:00
parent 25820024cd
commit a490c7e6c7
4 changed files with 3 additions and 11 deletions

View File

@ -62,6 +62,7 @@ cache:
- [ ] Add GitHub support - [ ] Add GitHub support
- [ ] Rename --gitlab flag to --remote - [ ] Rename --gitlab flag to --remote
- [ ] Add option to select individual remote for `gpm cache load` - [ ] Add option to select individual remote for `gpm cache load`
- [ ] Add flag for clone timeout for large repos
- [x] Use multi-gitlab by default in config init - [x] Use multi-gitlab by default in config init
- [x] Update docs for multi-gitlab - [x] Update docs for multi-gitlab
- [x] Remove all references to old keys - [x] Remove all references to old keys

View File

@ -8,7 +8,7 @@ import (
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/projects" "gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/projects"
) )
const gitCloneTimeoutSecs = 30 const gitCloneTimeoutSecs = 60
// Will either read in the current repo, preparing a report // Will either read in the current repo, preparing a report
// on its current state, or will clone the project if it has not // on its current state, or will clone the project if it has not

View File

@ -14,12 +14,6 @@ func (r *GiteaRemote) ReposToProjects(repos []*gitea.Repository) []*projects.Pro
pList := make([]*projects.Project, len(repos)) pList := make([]*projects.Project, len(repos))
for i, repo := range repos { for i, repo := range repos {
path := strings.Split(repo.FullName, "/") path := strings.Split(repo.FullName, "/")
var repoPath []string
if len(path) > 1 {
repoPath = path[:len(path)-1]
} else {
repoPath = path
}
project := &projects.Project{ project := &projects.Project{
ID: int(repo.ID), ID: int(repo.ID),
Description: repo.Description, Description: repo.Description,
@ -28,7 +22,7 @@ func (r *GiteaRemote) ReposToProjects(repos []*gitea.Repository) []*projects.Pro
WebURL: repo.HTMLURL, WebURL: repo.HTMLURL,
Name: repo.Name, Name: repo.Name,
NameWithNamespace: repo.FullName, NameWithNamespace: repo.FullName,
Path: strings.Join(repoPath, "/"), Path: path[len(path)-1],
AvatarURL: repo.AvatarURL, AvatarURL: repo.AvatarURL,
PathWithNamespace: strings.Join(path, "/"), PathWithNamespace: strings.Join(path, "/"),
LastActivityAt: repo.Updated, LastActivityAt: repo.Updated,

View File

@ -2,7 +2,6 @@ package gitearemote
import ( import (
"errors" "errors"
"fmt"
"code.gitea.io/sdk/gitea" "code.gitea.io/sdk/gitea"
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/load" "gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/load"
@ -20,8 +19,6 @@ func (r *GiteaRemote) StreamProjects(pi *load.ProgressInfo, opts *remote.RemoteQ
for { for {
repos, resp, err := r.api.ListMyRepos(gitea.ListReposOptions{ListOptions: giteaListOpts}) repos, resp, err := r.api.ListMyRepos(gitea.ListReposOptions{ListOptions: giteaListOpts})
fmt.Printf("Gitea PrevPage %d, NextPage %d, Pages %d\n", resp.PrevPage, resp.NextPage, resp.LastPage)
if err != nil { if err != nil {
pi.ErrorChan <- err pi.ErrorChan <- err
break break