-
Notifications
You must be signed in to change notification settings - Fork 55
/
promote.go
48 lines (39 loc) · 1.22 KB
/
promote.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
48
package buildinfo
import (
"github.com/jfrog/jfrog-cli-core/artifactory/utils"
"github.com/jfrog/jfrog-cli-core/utils/config"
"github.com/jfrog/jfrog-client-go/artifactory/services"
)
type BuildPromotionCommand struct {
services.PromotionParams
rtDetails *config.ArtifactoryDetails
dryRun bool
}
func NewBuildPromotionCommand() *BuildPromotionCommand {
return &BuildPromotionCommand{}
}
func (bpc *BuildPromotionCommand) SetDryRun(dryRun bool) *BuildPromotionCommand {
bpc.dryRun = dryRun
return bpc
}
func (bpc *BuildPromotionCommand) SetRtDetails(rtDetails *config.ArtifactoryDetails) *BuildPromotionCommand {
bpc.rtDetails = rtDetails
return bpc
}
func (bpc *BuildPromotionCommand) SetPromotionParams(params services.PromotionParams) *BuildPromotionCommand {
bpc.PromotionParams = params
return bpc
}
func (bpc *BuildPromotionCommand) Run() error {
servicesManager, err := utils.CreateServiceManager(bpc.rtDetails, bpc.dryRun)
if err != nil {
return err
}
return servicesManager.PromoteBuild(bpc.PromotionParams)
}
func (bpc *BuildPromotionCommand) RtDetails() (*config.ArtifactoryDetails, error) {
return bpc.rtDetails, nil
}
func (bpc *BuildPromotionCommand) CommandName() string {
return "rt_build_promote"
}