github.com/jfrog/jfrog-cli-go@v1.22.1-0.20200318093948-4826ef344ffd/artifactory/commands/buildinfo/clean.go (about) 1 package buildinfo 2 3 import ( 4 "github.com/jfrog/jfrog-cli-go/artifactory/utils" 5 "github.com/jfrog/jfrog-cli-go/utils/config" 6 "github.com/jfrog/jfrog-client-go/utils/log" 7 ) 8 9 type BuildCleanCommand struct { 10 buildConfiguration *utils.BuildConfiguration 11 } 12 13 func NewBuildCleanCommand() *BuildCleanCommand { 14 return &BuildCleanCommand{} 15 } 16 17 func (bcc *BuildCleanCommand) SetBuildConfiguration(buildConfiguration *utils.BuildConfiguration) *BuildCleanCommand { 18 bcc.buildConfiguration = buildConfiguration 19 return bcc 20 } 21 22 func (bcc *BuildCleanCommand) CommandName() string { 23 return "rt_build_clean" 24 } 25 26 // Returns the default Artifactory server 27 func (bcc *BuildCleanCommand) RtDetails() (*config.ArtifactoryDetails, error) { 28 return config.GetDefaultArtifactoryConf() 29 } 30 31 func (bcc *BuildCleanCommand) Run() error { 32 log.Info("Cleaning build info...") 33 err := utils.RemoveBuildDir(bcc.buildConfiguration.BuildName, bcc.buildConfiguration.BuildNumber) 34 if err != nil { 35 return err 36 } 37 log.Info("Cleaned build info", bcc.buildConfiguration.BuildName+"/"+bcc.buildConfiguration.BuildNumber+".") 38 return nil 39 }