Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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: 13 additions & 2 deletions artifactory/utils/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,18 @@ func SearchResultNoDate(reader *content.ContentReader) (contentReader *content.C
return
}

// SearchFiles performs a search operation using the provided spec files.
// This is a wrapper around SearchFilesBySpecs for backward compatibility.
func SearchFiles(servicesManager artifactory.ArtifactoryServicesManager, spec *spec.SpecFiles) (searchResults []*content.ContentReader, callbackFunc func() error, err error) {
return SearchFilesBySpecs(servicesManager, spec.Files)
}

// SearchFilesBySpecs performs a search operation using the provided file specifications.
// It supports multiple source types including artifacts, packages, and release bundles.
func SearchFilesBySpecs(servicesManager artifactory.ArtifactoryServicesManager, files []spec.File) (searchResults []*content.ContentReader, callbackFunc func() error, err error) {
if len(files) == 0 {
return nil, nil, errorutils.CheckErrorf("no files provided for search")
}
callbackFunc = func() error {
var errs error
for _, reader := range searchResults {
Expand All @@ -177,8 +188,8 @@ func SearchFiles(servicesManager artifactory.ArtifactoryServicesManager, spec *s

var curSearchParams services.SearchParams
var curReader *content.ContentReader
for i := 0; i < len(spec.Files); i++ {
curSearchParams, err = GetSearchParams(spec.Get(i))
for i := 0; i < len(files); i++ {
curSearchParams, err = GetSearchParams(&files[i])
if err != nil {
return
}
Expand Down
25 changes: 17 additions & 8 deletions common/spec/specfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ type File struct {
Transitive string
TargetPathInArchive string
include []string
Package string `json:"package,omitempty"`
Version string `json:"version,omitempty"`
Type string `json:"type,omitempty"`
RepoKey string `json:"repoKey,omitempty"`
}

func (f File) GetInclude() []string {
Expand Down Expand Up @@ -217,6 +221,11 @@ func ValidateSpec(files []File, isTargetMandatory, isSearchBasedSpec bool) error
isExplode, _ := file.IsExplode(false)
isBypassArchiveInspection, _ := file.IsBypassArchiveInspection(false)
isTransitive, _ := file.IsTransitive(false)
isPackage := len(file.Package) > 0
isVersion := len(file.Version) > 0
isType := len(file.Type) > 0
isRepoKey := len(file.RepoKey) > 0

if isPathMapping {
if !isAql {
return errorutils.CheckErrorf("pathMapping is supported only with aql")
Expand All @@ -234,11 +243,9 @@ func ValidateSpec(files []File, isTargetMandatory, isSearchBasedSpec bool) error
if !isSearchBasedSpec && !isPattern {
return errorutils.CheckErrorf("spec must include a pattern")
}
if isBuild && isBundle {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this condition removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fluxxBot Because this condition isn't valid anymore. It may be both builds and bundles

return fileSpecValidationError("build", "bundle")
}
if isSearchBasedSpec && !isAql && !isPattern && !isBuild && !isBundle {
return errorutils.CheckErrorf("spec must include either aql, pattern, build or bundle")

if isSearchBasedSpec && !isAql && !isPattern && !isBuild && !isBundle && !isPackage {
return errorutils.CheckErrorf("spec must include either aql, pattern, build, bundle or package")
}
if isOffset {
if isBuild {
Expand All @@ -259,9 +266,6 @@ func ValidateSpec(files []File, isTargetMandatory, isSearchBasedSpec bool) error
return fileSpecValidationError("bundle", "limit")
}
}
if isAql && isPattern {
return fileSpecValidationError("aql", "pattern")
}
if isAql && isExclusions {
return fileSpecValidationError("aql", "exclusions")
}
Expand Down Expand Up @@ -295,6 +299,11 @@ func ValidateSpec(files []File, isTargetMandatory, isSearchBasedSpec bool) error
if isBypassArchiveInspection && !isExplode {
return errorutils.CheckErrorf("spec cannot include 'bypass-archive-inspection' if 'explode' is not included")
}
if isPackage {
if !isVersion || !isType || !isRepoKey {
return errorutils.CheckErrorf("spec with type 'package' must include 'version', 'type' and 'repo_key'")
}
}
}
return nil
}
Expand Down
1 change: 0 additions & 1 deletion general/token/oidctokenexchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,5 @@ func (otc *OidcTokenExchangeCommand) getOidcTokenParams() services.CreateOidcTok
oidcTokenParams.Repo = otc.Repository
oidcTokenParams.Audience = otc.Audience
oidcTokenParams.ProviderName = otc.ProviderName
oidcTokenParams.ProviderType = otc.ProviderType.String()
return oidcTokenParams
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ require (
sigs.k8s.io/yaml v1.4.0 // indirect
)

// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20250610112448-de5e55438dba
replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20250619121353-6ff3439c999d

// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20250611113558-c1a092f216fd

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ github.com/jfrog/build-info-go v1.10.14 h1:PWnw+rBwiQTHZ5q+84+E8MHFjtAQkB3+Oc2sK
github.com/jfrog/build-info-go v1.10.14/go.mod h1:JcISnovFXKx3wWf3p1fcMmlPdt6adxScXvoJN4WXqIE=
github.com/jfrog/gofrog v1.7.6 h1:QmfAiRzVyaI7JYGsB7cxfAJePAZTzFz0gRWZSE27c6s=
github.com/jfrog/gofrog v1.7.6/go.mod h1:ntr1txqNOZtHplmaNd7rS4f8jpA5Apx8em70oYEe7+4=
github.com/jfrog/jfrog-client-go v1.54.1 h1:IvobRCmwFS/HDht6Vv1JtGzPPytmOX3qS57hRC5fU98=
github.com/jfrog/jfrog-client-go v1.54.1/go.mod h1:1v0eih4thdPA4clBo9TuvAMT25sGDr1IQJ81DXQ/lBY=
github.com/jfrog/jfrog-client-go v1.28.1-0.20250619121353-6ff3439c999d h1:0TNgRnYr92lmxC4my2P07MqaWmYBuLP/sgoCD5k/fhA=
github.com/jfrog/jfrog-client-go v1.28.1-0.20250619121353-6ff3439c999d/go.mod h1:1v0eih4thdPA4clBo9TuvAMT25sGDr1IQJ81DXQ/lBY=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
Expand Down
Loading