From a82a817f5b63c63ee5facb1dd864d41ec90b7ba8 Mon Sep 17 00:00:00 2001 From: Bhanu Reddy Date: Mon, 28 Aug 2023 13:48:30 +0530 Subject: [PATCH] Updated pipelines definitions --- go.mod | 2 +- go.sum | 4 ++-- pipelines/commands/pipelinedefinitions.go | 6 ++---- pipelines/commands/validate.go | 7 ++----- pipelines/commands/workspace.go | 3 +-- pipelines/commands/workspacerunstatus.go | 2 +- 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index d8791b5f8..88e26ebf0 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 63a72106b..bc731292b 100644 --- a/go.sum +++ b/go.sum @@ -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= @@ -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= diff --git a/pipelines/commands/pipelinedefinitions.go b/pipelines/commands/pipelinedefinitions.go index 33bec3496..95f319c51 100644 --- a/pipelines/commands/pipelinedefinitions.go +++ b/pipelines/commands/pipelinedefinitions.go @@ -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 diff --git a/pipelines/commands/validate.go b/pipelines/commands/validate.go index 7efcd338f..b39137072 100644 --- a/pipelines/commands/validate.go +++ b/pipelines/commands/validate.go @@ -12,7 +12,6 @@ import ( type ValidateCommand struct { serverDetails *config.ServerDetails files string - data []byte directory string } @@ -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 { diff --git a/pipelines/commands/workspace.go b/pipelines/commands/workspace.go index a9b3e2760..f50003651 100644 --- a/pipelines/commands/workspace.go +++ b/pipelines/commands/workspace.go @@ -25,7 +25,6 @@ const ( type WorkspaceRunCommand struct { serverDetails *config.ServerDetails pathToFiles string - data []byte project string values string } @@ -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) diff --git a/pipelines/commands/workspacerunstatus.go b/pipelines/commands/workspacerunstatus.go index edfb8d41f..bb220006f 100644 --- a/pipelines/commands/workspacerunstatus.go +++ b/pipelines/commands/workspacerunstatus.go @@ -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) }