Gitea remote support
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package remotes
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/load"
|
||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/projects"
|
||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/remote"
|
||||
@@ -33,7 +35,7 @@ func (r *Remotes) GetRemoteByHost(host string) remote.Remote {
|
||||
// Launches project streamsers for all remotes in goroutines
|
||||
// returns slice of load.ProgressInfo, does not block, streamer is
|
||||
// launched in goroutine
|
||||
func StreamRemote(r remote.Remote, opts *remote.RemoteQueryOpts) *load.ProgressInfo {
|
||||
func StreamRemote(r remote.Remote, opts *remote.RemoteQueryOpts) (*load.ProgressInfo, error) {
|
||||
progressInfo := &load.ProgressInfo{
|
||||
ProgressChan: make(chan load.Progress),
|
||||
ProjectsChan: make(chan []*projects.Project),
|
||||
@@ -41,8 +43,11 @@ func StreamRemote(r remote.Remote, opts *remote.RemoteQueryOpts) *load.ProgressI
|
||||
DoneChan: make(chan interface{}),
|
||||
NumProjects: r.GetNumProjects(opts),
|
||||
}
|
||||
if progressInfo.NumProjects < 1 {
|
||||
return nil, errors.New("Failed to fetch project count from remote, won't load")
|
||||
}
|
||||
go r.StreamProjects(progressInfo, opts)
|
||||
return progressInfo
|
||||
return progressInfo, nil
|
||||
}
|
||||
|
||||
func NewRemotes() *Remotes {
|
||||
|
||||
Reference in New Issue
Block a user