forked from rancher/rancher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remote.go
30 lines (26 loc) · 860 Bytes
/
remote.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package remote
import (
"errors"
"github.com/rancher/rancher/pkg/pipeline/remote/bitbucketcloud"
"github.com/rancher/rancher/pkg/pipeline/remote/bitbucketserver"
"github.com/rancher/rancher/pkg/pipeline/remote/github"
"github.com/rancher/rancher/pkg/pipeline/remote/gitlab"
"github.com/rancher/rancher/pkg/pipeline/remote/model"
"github.com/rancher/types/apis/project.cattle.io/v3"
)
func New(config interface{}) (model.Remote, error) {
if config == nil {
return github.New(nil)
}
switch config := config.(type) {
case *v3.GithubPipelineConfig:
return github.New(config)
case *v3.GitlabPipelineConfig:
return gitlab.New(config)
case *v3.BitbucketCloudPipelineConfig:
return bitbucketcloud.New(config)
case *v3.BitbucketServerPipelineConfig:
return bitbucketserver.New(config)
}
return nil, errors.New("unsupported remote type")
}