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

Support for Distribution path mapping with AQL #1031

Merged
merged 2 commits into from
Nov 27, 2023
Merged
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
15 changes: 14 additions & 1 deletion common/spec/specfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func CreateSpecFromFile(specFilePath string, specVars map[string]string) (spec *

type File struct {
Aql utils.Aql
PathMapping utils.PathMapping
Pattern string
Exclusions []string
Target string
Expand Down Expand Up @@ -148,6 +149,7 @@ func (f *File) ToCommonParams() (*utils.CommonParams, error) {
}

params.Aql = f.Aql
params.PathMapping = f.PathMapping
params.Pattern = f.Pattern
params.Exclusions = f.Exclusions
params.Target = f.Target
Expand All @@ -171,6 +173,7 @@ func ValidateSpec(files []File, isTargetMandatory, isSearchBasedSpec bool) error

for _, file := range files {
isAql := len(file.Aql.ItemsFind) > 0
isPathMapping := len(file.PathMapping.Input) > 0 && len(file.PathMapping.Output) > 0
isPattern := len(file.Pattern) > 0
isExclusions := len(file.Exclusions) > 0 && len(file.Exclusions[0]) > 0
isTarget := len(file.Target) > 0
Expand All @@ -193,7 +196,17 @@ func ValidateSpec(files []File, isTargetMandatory, isSearchBasedSpec bool) error
isExplode, _ := file.IsExplode(false)
isBypassArchiveInspection, _ := file.IsBypassArchiveInspection(false)
isTransitive, _ := file.IsTransitive(false)

if isPathMapping {
if !isAql {
return errorutils.CheckErrorf("pathMapping is supported only with aql")
}
if isTarget {
return fileSpecValidationError("pathMapping", "target")
}
if isPattern {
return fileSpecValidationError("pathMapping", "pattern")
}
}
if isTargetMandatory && !isTarget {
return errorutils.CheckErrorf("spec must include target")
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ require (
gopkg.in/warnings.v0 v0.1.2 // indirect
)

// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go dev
replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20231126134442-14887b84b87a

replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20231119150101-5cfbe8fca39e
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ 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.5 h1:NYZrOHvT5D5BwwHdArIz5WnbP+DPbADjV/SPdN33bfQ=
github.com/jfrog/jfrog-client-go v1.34.5/go.mod h1:0PVhP6xGvBBaUzOU9LKf5OYkke/gY2IFILHA++iabFM=
github.com/jfrog/jfrog-client-go v1.28.1-0.20231126134442-14887b84b87a h1:hZFfT7i+vwhDhJ7xf211XbS9uxjR83vC618di1Eo0wo=
github.com/jfrog/jfrog-client-go v1.28.1-0.20231126134442-14887b84b87a/go.mod h1:0PVhP6xGvBBaUzOU9LKf5OYkke/gY2IFILHA++iabFM=
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
Loading