Skip to content

Commit

Permalink
Updated pipelines definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
bhanurp committed Aug 28, 2023
1 parent 27795af commit a82a817
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ require (
gopkg.in/warnings.v0 v0.1.2 // indirect
)

// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20230803140217-0a5f43783ae8
replace github.com/jfrog/jfrog-client-go => github.com/bhanurp/jfrog-client-go v0.0.0-20230828081751-9d51140a98af

// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20230820165857-52ff32c4d8eb

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHG
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/bhanurp/jfrog-client-go v0.0.0-20230828081751-9d51140a98af h1:FJ5DIVRg08312xwO8WsdLPbht6ATR5x8FTsiVr/Uyx4=
github.com/bhanurp/jfrog-client-go v0.0.0-20230828081751-9d51140a98af/go.mod h1:icb00ZJN/mMMNkQduHDkzpqsXH9Flwi3f3COYexq3Nc=
github.com/bradleyjkemp/cupaloy/v2 v2.8.0 h1:any4BmKE+jGIaMpnU8YgH/I2LPiLBufr6oMMlVBbn9M=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
Expand Down Expand Up @@ -200,8 +202,6 @@ github.com/jfrog/build-info-go v1.9.8 h1:D8/ga+YgQpqp/CJj2zteS4/twmSy8zvm1v9lCd2
github.com/jfrog/build-info-go v1.9.8/go.mod h1:t31QRpH5xUJKw8XkQlAA+Aq7aanyS1rrzpcK8xSNVts=
github.com/jfrog/gofrog v1.3.0 h1:o4zgsBZE4QyDbz2M7D4K6fXPTBJht+8lE87mS9bw7Gk=
github.com/jfrog/gofrog v1.3.0/go.mod h1:IFMc+V/yf7rA5WZ74CSbXe+Lgf0iApEQLxRZVzKRUR0=
github.com/jfrog/jfrog-client-go v1.31.5 h1:dYVgIJzMwX+EU9GEELKPSHFLyfW6UrrjZWMEZtAyx6A=
github.com/jfrog/jfrog-client-go v1.31.5/go.mod h1:icb00ZJN/mMMNkQduHDkzpqsXH9Flwi3f3COYexq3Nc=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
Expand Down
6 changes: 2 additions & 4 deletions pipelines/commands/pipelinedefinitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ type ValidationFiles struct {
func structureFileContentAsPipelineDefinition(allPipelineFiles []string, values string) ([]PipelineDefinition, error) {
var pipelineDefinitions []PipelineDefinition
for _, pathToFile := range allPipelineFiles {
log.Info("Attaching pipelines definition file: ", pathToFile)
log.Debug("Attaching pipelines definition file: ", pathToFile)
fileContent, fileInfo, err := utils.GetFileContentAndBaseName(pathToFile)
if err != nil {
return nil, err
}
ymlType := "pipelines"
ymlType := ""
if strings.EqualFold(fileInfo.Name(), "values.yml") {
ymlType = "values"
} else if strings.Contains(fileInfo.Name(), "resources") {
ymlType = "resources"
}
if len(fileContent) == 0 {
continue
Expand Down
7 changes: 2 additions & 5 deletions pipelines/commands/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
type ValidateCommand struct {
serverDetails *config.ServerDetails
files string
data []byte
directory string
}

Expand Down Expand Up @@ -72,11 +71,9 @@ func (vc *ValidateCommand) preparePayload() ([]byte, error) {
filesFromDir, err := utils.GetAllFilesFromDirectory(vc.directory)
if err != nil && len(vc.files) == 0 {
return []byte{}, err
} else if err != nil {
log.Warn("Unable to read files from directory ", vc.directory, " proceeding with validation on ", vc.files)
} else {
files = filesFromDir
}
log.Info("Proceeding with validation on ", vc.files)
files = filesFromDir
}
pipelineDefinitions, err := structureFileContentAsPipelineDefinition(files, "")
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions pipelines/commands/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const (
type WorkspaceRunCommand struct {
serverDetails *config.ServerDetails
pathToFiles string
data []byte
project string
values string
}
Expand Down Expand Up @@ -149,7 +148,7 @@ func (wc *WorkspaceRunCommand) pollSyncStatusAndTriggerRun(serviceManager *pipel
if err != nil {
return err
}
pipelineNames := make([]string, len(pipelinesBranch))
pipelineNames := make([]string, 0)
for pipName, branch := range pipelinesBranch {
log.Info(coreutils.PrintTitle("Triggering pipeline run for: "), pipName)
pipelineNames = append(pipelineNames, pipName)
Expand Down
2 changes: 1 addition & 1 deletion pipelines/commands/workspacerunstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (wrs *WorkspaceRunStatusCommand) Run() error {
if err != nil {
return err
}
pipelineNames := make([]string, len(pipelinesBranch))
pipelineNames := make([]string, 0)
for pipName := range pipelinesBranch {
pipelineNames = append(pipelineNames, pipName)
}
Expand Down

0 comments on commit a82a817

Please sign in to comment.