-
Notifications
You must be signed in to change notification settings - Fork 55
/
sync.go
47 lines (38 loc) · 1.04 KB
/
sync.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package commands
import (
"github.com/jfrog/jfrog-cli-core/v2/pipelines/manager"
"github.com/jfrog/jfrog-cli-core/v2/utils/config"
)
type SyncCommand struct {
serverDetails *config.ServerDetails
branch string
repositoryFullName string
}
func NewSyncCommand() *SyncCommand {
return &SyncCommand{}
}
func (sc *SyncCommand) ServerDetails() (*config.ServerDetails, error) {
return sc.serverDetails, nil
}
func (sc *SyncCommand) SetServerDetails(serverDetails *config.ServerDetails) *SyncCommand {
sc.serverDetails = serverDetails
return sc
}
func (sc *SyncCommand) CommandName() string {
return "pl_sync"
}
func (sc *SyncCommand) SetBranch(br string) *SyncCommand {
sc.branch = br
return sc
}
func (sc *SyncCommand) SetRepositoryFullName(rfn string) *SyncCommand {
sc.repositoryFullName = rfn
return sc
}
func (sc *SyncCommand) Run() error {
serviceManager, err := manager.CreateServiceManager(sc.serverDetails)
if err != nil {
return err
}
return serviceManager.SyncPipelineResource(sc.branch, sc.repositoryFullName)
}