Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for validation of signed pipelines #1017

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion artifactory/commands/buildinfo/adddependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
92 changes: 92 additions & 0 deletions pipelines/commands/ValidateSignedPipelines.go
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 1 addition & 1 deletion xray/commands/scan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Loading