Gitea remote support

This commit is contained in:
2024-01-16 14:26:56 -05:00
parent bd354842c0
commit 94bbff6d07
8 changed files with 49 additions and 10 deletions

View File

@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net"
"net/url"
"time"
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/config"
@ -26,6 +27,7 @@ const defNetDialTimeoutSecs = 3
// provided by *load.ProgressInfo
type Remote interface {
GetInfo() *RemoteInfo // Returns basic RemoteInfo struct
String() string // String info for remote
GetNumProjects(*RemoteQueryOpts) int // Returns total number of accessible projects
StreamProjects(*load.ProgressInfo, *RemoteQueryOpts) // Streams projects to chans provided in load.ProgressInfo
}
@ -39,8 +41,10 @@ func IsAlive(remote Remote) bool {
port = 22
}
remoteUrl, _ := url.Parse(remote.GetInfo().Host)
d, err := net.DialTimeout("tcp",
fmt.Sprintf("%s:%d", remote.GetInfo().Host, port),
fmt.Sprintf("%s:%d", remoteUrl.Host, port),
defNetDialTimeoutSecs*time.Second)
if err == nil {