diff --git a/artifactory/commands/buildinfo/adddependencies.go b/artifactory/commands/buildinfo/adddependencies.go index 1754a546c..7dd3258f0 100644 --- a/artifactory/commands/buildinfo/adddependencies.go +++ b/artifactory/commands/buildinfo/adddependencies.go @@ -262,7 +262,7 @@ func collectPatternMatchingFiles(addDepsParams *specutils.CommonParams, rootPath return nil, err } - paths, err := fspatterns.ListFiles(rootPath, addDepsParams.IsRecursive(), addDepsParams.IsIncludeDirs(), true, excludePathPattern) + paths, err := fspatterns.ListFiles(rootPath, addDepsParams.IsRecursive(), addDepsParams.IsIncludeDirs(), true, false, excludePathPattern) if err != nil { return nil, err } diff --git a/go.mod b/go.mod index 22f60750f..737d98b1b 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/google/uuid v1.3.1 github.com/gookit/color v1.5.4 github.com/jedib0t/go-pretty/v6 v6.4.8 - github.com/jfrog/build-info-go v1.9.14 + github.com/jfrog/build-info-go v1.9.15 github.com/jfrog/gofrog v1.3.1 github.com/jfrog/jfrog-apps-config v1.0.1 github.com/jfrog/jfrog-client-go v1.34.3 @@ -99,6 +99,6 @@ 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.20231003120621-90e9d7ea05e9 +replace github.com/jfrog/jfrog-client-go => github.com/bhanurp/jfrog-client-go v0.0.0-20231129012627-32b9ad75d217 replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20231031143744-13f94ab07bbc diff --git a/go.sum b/go.sum index 457c753f7..d47ef486a 100644 --- a/go.sum +++ b/go.sum @@ -60,6 +60,8 @@ github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu 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-20231129012627-32b9ad75d217 h1:y4zDWb6mA35S1iudNJg6jmG6E75/kGJhW/qNAcXqdnE= +github.com/bhanurp/jfrog-client-go v0.0.0-20231129012627-32b9ad75d217/go.mod h1:0PVhP6xGvBBaUzOU9LKf5OYkke/gY2IFILHA++iabFM= 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= @@ -202,8 +204,6 @@ github.com/jfrog/gofrog v1.3.1 h1:QqAwQXCVReT724uga1AYqG/ZyrNQ6f+iTxmzkb+YFQk= github.com/jfrog/gofrog v1.3.1/go.mod h1:IFMc+V/yf7rA5WZ74CSbXe+Lgf0iApEQLxRZVzKRUR0= github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYLipdsOFMY= github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w= -github.com/jfrog/jfrog-client-go v1.34.3 h1:kDfw3FUQQvOsTKFqonIgLlziez6CSX80xCYZIH9YYcg= -github.com/jfrog/jfrog-client-go v1.34.3/go.mod h1:fuxhYzWEkA16+ZV5cP/BJUGjA3SXVKbBoDmb8ZS6J4g= 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/ValidateSignedPipelines.go b/pipelines/commands/ValidateSignedPipelines.go new file mode 100644 index 000000000..3142df872 --- /dev/null +++ b/pipelines/commands/ValidateSignedPipelines.go @@ -0,0 +1,92 @@ +package commands + +import ( + "github.com/jfrog/jfrog-cli-core/v2/pipelines/manager" + "github.com/jfrog/jfrog-cli-core/v2/utils/config" + "github.com/jfrog/jfrog-client-go/pipelines/services" +) + +type ValidateSignedPipelinesCommand struct { + serverDetails *config.ServerDetails + artifactType string + buildName string + buildNumber string + projectKey string + artifactPath string + releaseBundleName string + releaseBundleVersion string +} + +func NewValidateSignedPipelinesCommand() *ValidateSignedPipelinesCommand { + return &ValidateSignedPipelinesCommand{} +} + +func (vspc *ValidateSignedPipelinesCommand) ServerDetails() (*config.ServerDetails, error) { + return vspc.serverDetails, nil +} + +func (vspc *ValidateSignedPipelinesCommand) SetServerDetails(serverDetails *config.ServerDetails) *ValidateSignedPipelinesCommand { + vspc.serverDetails = serverDetails + return vspc +} + +func (vspc *ValidateSignedPipelinesCommand) CommandName() string { + return "pl_validate_signed_pipelines" +} + +func (vspc *ValidateSignedPipelinesCommand) SetArtifactType(artifact string) *ValidateSignedPipelinesCommand { + vspc.artifactType = artifact + return vspc +} + +func (vspc *ValidateSignedPipelinesCommand) SetBuildName(name string) *ValidateSignedPipelinesCommand { + vspc.buildName = name + return vspc +} + +func (vspc *ValidateSignedPipelinesCommand) SetBuildNumber(number string) *ValidateSignedPipelinesCommand { + vspc.buildNumber = number + return vspc +} + +func (vspc *ValidateSignedPipelinesCommand) SetProjectKey(project string) *ValidateSignedPipelinesCommand { + vspc.projectKey = project + return vspc +} + +func (vspc *ValidateSignedPipelinesCommand) SetArtifactPath(artifact string) *ValidateSignedPipelinesCommand { + vspc.artifactPath = artifact + return vspc +} + +func (vspc *ValidateSignedPipelinesCommand) SetReleaseBundleName(name string) *ValidateSignedPipelinesCommand { + vspc.releaseBundleName = name + return vspc +} + +func (vspc *ValidateSignedPipelinesCommand) SetReleaseBundleVersion(version string) *ValidateSignedPipelinesCommand { + vspc.releaseBundleVersion = version + return vspc +} + +func (vspc *ValidateSignedPipelinesCommand) Run() error { + serviceManager, err := manager.CreateServiceManager(vspc.serverDetails) + if err != nil { + return err + } + artifactTypeInfo := services.ArtifactTypeInfo{} + artifactTypeInfo.BuildNumber = vspc.buildNumber + artifactTypeInfo.BuildName = vspc.buildName + artifactTypeInfo.ProjectKey = vspc.projectKey + artifactTypeInfo.ArtifactPath = vspc.artifactPath + artifactTypeInfo.RbName = vspc.releaseBundleName + artifactTypeInfo.RbVersion = vspc.releaseBundleVersion + artifactType := services.Artifact + if vspc.artifactType == services.BuildInfo.String() { + artifactType = services.BuildInfo + } else if vspc.artifactType == services.ReleaseBundle.String() { + artifactType = services.ReleaseBundle + } + err = serviceManager.ValidateSignedPipelines(artifactTypeInfo, artifactType) + return err +} diff --git a/xray/commands/scan/scan.go b/xray/commands/scan/scan.go index 7a291a21c..705c666b2 100644 --- a/xray/commands/scan/scan.go +++ b/xray/commands/scan/scan.go @@ -410,7 +410,7 @@ func collectPatternMatchingFiles(fileData spec.File, rootPath string, dataHandle return err } - paths, err := fspatterns.ListFiles(rootPath, recursive, false, false, excludePathPattern) + paths, err := fspatterns.ListFiles(rootPath, recursive, false, false, false, excludePathPattern) if err != nil { return err }