Skip to content
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
5 changes: 3 additions & 2 deletions artifactory/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ func setPropsCmd(c *components.Context) error {
if err != nil {
return err
}
propsCmd := generic.NewSetPropsCommand().SetPropsCommand(*cmd)
propsCmd := generic.NewSetPropsCommand().SetPropsCommand(*cmd).SetRepoOnly(c.GetBoolFlagValue("repo-only"))
propsCmd.SetRetries(retries).SetRetryWaitMilliSecs(retryWaitTime)
err = commands.Exec(propsCmd)
result := propsCmd.Result()
Expand All @@ -1102,7 +1102,7 @@ func deletePropsCmd(c *components.Context) error {
if err != nil {
return err
}
propsCmd := generic.NewDeletePropsCommand().DeletePropsCommand(*cmd)
propsCmd := generic.NewDeletePropsCommand().DeletePropsCommand(*cmd).SetRepoOnly(c.GetBoolFlagValue("repo-only"))
propsCmd.SetRetries(retries).SetRetryWaitMilliSecs(retryWaitTime)
err = commands.Exec(propsCmd)
result := propsCmd.Result()
Expand Down Expand Up @@ -1558,6 +1558,7 @@ func createDefaultPropertiesSpec(c *components.Context) (*spec.SpecFiles, error)
Exclusions(c.GetStringsArrFlagValue("exclusions")).
IncludeDirs(c.GetBoolFlagValue("include-dirs")).
ArchiveEntries(c.GetStringFlagValue("archive-entries")).
RepoOnly(c.GetBoolTFlagValue("repo-only")).
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be changed based on repo-only default value false

BuildSpec(), nil
}

Expand Down
7 changes: 6 additions & 1 deletion artifactory/commands/generic/deleteprops.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ func (dp *DeletePropsCommand) DeletePropsCommand(command PropsCommand) *DeletePr
return dp
}

func (dp *DeletePropsCommand) SetRepoOnly(repoOnly bool) *DeletePropsCommand {
dp.PropsCommand.repoOnly = repoOnly
return dp
}

func (dp *DeletePropsCommand) CommandName() string {
return "rt_delete_properties"
}
Expand All @@ -35,7 +40,7 @@ func (dp *DeletePropsCommand) Run() error {
return err
}
defer reader.Close()
propsParams := GetPropsParams(reader, dp.props)
propsParams := GetPropsParams(reader, dp.props, dp.repoOnly)
success, err := servicesManager.DeleteProps(propsParams)
result := dp.Result()
result.SetSuccessCount(success)
Expand Down
13 changes: 10 additions & 3 deletions artifactory/commands/generic/props.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import (
)

type PropsCommand struct {
props string
threads int
props string
threads int
repoOnly bool
GenericCommand
}

Expand All @@ -42,6 +43,11 @@ func (pc *PropsCommand) SetProps(props string) *PropsCommand {
return pc
}

func (pc *PropsCommand) SetRepoOnlyFlag(repoOnly bool) *PropsCommand {
pc.repoOnly = repoOnly
return pc
}

func createPropsServiceManager(threads, httpRetries, retryWaitMilliSecs int, serverDetails *config.ServerDetails) (artifactory.ArtifactoryServicesManager, error) {
certsPath, err := coreutils.GetJfrogCertsDir()
if err != nil {
Expand Down Expand Up @@ -98,9 +104,10 @@ func searchItems(spec *spec.SpecFiles, servicesManager artifactory.ArtifactorySe
return
}

func GetPropsParams(reader *content.ContentReader, properties string) (propsParams services.PropsParams) {
func GetPropsParams(reader *content.ContentReader, properties string, repoOnly bool) (propsParams services.PropsParams) {
propsParams = services.NewPropsParams()
propsParams.Reader = reader
propsParams.Props = properties
propsParams.RepoOnly = repoOnly
return
}
7 changes: 6 additions & 1 deletion artifactory/commands/generic/setprops.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ func (setProps *SetPropsCommand) SetPropsCommand(command PropsCommand) *SetProps
return setProps
}

func (setProps *SetPropsCommand) SetRepoOnly(repoOnly bool) *SetPropsCommand {
setProps.PropsCommand.repoOnly = repoOnly
return setProps
}

func (setProps *SetPropsCommand) CommandName() string {
return "rt_set_properties"
}
Expand All @@ -39,7 +44,7 @@ func (setProps *SetPropsCommand) Run() (err error) {
defer func() {
err = errors.Join(err, reader.Close())
}()
propsParams := GetPropsParams(reader, setProps.props)
propsParams := GetPropsParams(reader, setProps.props, setProps.repoOnly)
success, err := servicesManager.SetProps(propsParams)

result := setProps.Result()
Expand Down
4 changes: 3 additions & 1 deletion cliutils/flagkit/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ const (
props = "props"
targetProps = "target-props"
excludeProps = "exclude-props"
repoOnly = "repo-only"
failNoOp = "fail-no-op"
threads = "threads"
syncDeletes = "sync-deletes"
Expand Down Expand Up @@ -579,7 +580,7 @@ var commandFlags = map[string][]string{
url, user, password, accessToken, sshPassphrase, sshKeyPath, serverId, ClientCertPath,
ClientCertKeyPath, specFlag, specVars, exclusions, sortBy, sortOrder, limit, offset,
propsRecursive, build, includeDeps, excludeArtifacts, bundle, includeDirs, failNoOp, threads, archiveEntries, propsProps, propsExcludeProps,
InsecureTls, retries, retryWaitTime, Project,
InsecureTls, retries, retryWaitTime, Project, repoOnly,
},
BuildPublish: {
url, user, password, accessToken, sshPassphrase, sshKeyPath, serverId, buildUrl, bpDryRun,
Expand Down Expand Up @@ -901,6 +902,7 @@ var flagsMap = map[string]components.Flag{
propsRecursive: components.NewBoolFlag(Recursive, "[Default: true] When false, artifacts inside sub-folders in Artifactory will not be affected.", components.WithBoolDefaultValueFalse()),
propsProps: components.NewStringFlag(props, "[Optional] List of semicolon-separated(;) properties in the form of \"key1=value1;key2=value2;...\". Only artifacts with these properties are affected.", components.SetMandatoryFalse()),
propsExcludeProps: components.NewStringFlag(excludeProps, "[Optional] List of semicolon-separated(;) properties in the form of \"key1=value1;key2=value2;...\". Only artifacts without the specified properties are affected.", components.SetMandatoryFalse()),
repoOnly: components.NewBoolFlag(repoOnly, "[Default: true] When false, artifacts inside sub-folders in Artifactory will be affected.", components.WithBoolDefaultValueFalse()),
Copy link
Collaborator

Choose a reason for hiding this comment

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

default should be false, there are more users using --repo-only false instead of true


// Build Publish and Append specific commands flags
buildUrl: components.NewStringFlag(buildUrl, "[Optional] Can be used for setting the CI server build URL in the build-info.", components.SetMandatoryFalse()),
Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/jfrog/froggit-go v1.17.0
github.com/jfrog/gofrog v1.7.6
github.com/jfrog/jfrog-cli-core/v2 v2.59.0
github.com/jfrog/jfrog-client-go v1.54.1
github.com/jfrog/jfrog-client-go v1.54.2
github.com/pkg/errors v0.9.1
github.com/secure-systems-lab/go-securesystemslib v0.8.0
github.com/spf13/viper v1.19.0
Expand Down Expand Up @@ -132,8 +132,9 @@ require (
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20250619122826-54ff6f65b128
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.59.2-0.20250709124419-1e5e14be13da

replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20250709124344-d59cca9cd76a

replace github.com/jfrog/jfrog-client-go => github.com/naveenku-jfrog/jfrog-client-go v1.28.1-0.20250709071939-91024bdb9f76

//replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20240811142930-ab9715567376
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ github.com/jfrog/froggit-go v1.17.0 h1:20Ie787WO27SwB2MOHDvsR6yN7fA5WfRnuAbmUqz1
github.com/jfrog/froggit-go v1.17.0/go.mod h1:HvDkfFfJwIdsXFdqaB+utvD2cLDRmaC3kF8otYb6Chw=
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-cli-core/v2 v2.31.1-0.20250619122826-54ff6f65b128 h1:SdNS8Z1H1c1wgtHxZJNjLf9cWx+zdfXDQPmjUwQ55Bo=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20250619122826-54ff6f65b128/go.mod h1:JDMYJHxU3W0/jaiiSljHLAcd0QeEGwpAwsnOqVR8c/0=
github.com/jfrog/jfrog-cli-core/v2 v2.59.2-0.20250709124419-1e5e14be13da h1:uDMQ6tdKI7nk3Z4fwYv0xcdQZVGnrt58+Wk5970c6Zk=
github.com/jfrog/jfrog-cli-core/v2 v2.59.2-0.20250709124419-1e5e14be13da/go.mod h1:pcAx7PFOLiw82c6fBDJw3BfIfUQdoHsxWd5u/XH9XEM=
github.com/jfrog/jfrog-client-go v1.28.1-0.20250709124344-d59cca9cd76a h1:UJNIEx2O+tgwVacsWF6csTRxGo/CByminrf5LujuzTk=
github.com/jfrog/jfrog-client-go v1.28.1-0.20250709124344-d59cca9cd76a/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/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
Expand Down Expand Up @@ -199,8 +201,6 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/naveenku-jfrog/jfrog-client-go v1.28.1-0.20250709071939-91024bdb9f76 h1:0aD2ghvGcB28CNCN+z2DtCfTGbmTagVBw0GAgCe2nIk=
github.com/naveenku-jfrog/jfrog-client-go v1.28.1-0.20250709071939-91024bdb9f76/go.mod h1:1v0eih4thdPA4clBo9TuvAMT25sGDr1IQJ81DXQ/lBY=
github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9lEc=
github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
github.com/onsi/ginkgo/v2 v2.14.0 h1:vSmGj2Z5YPb9JwCWT6z6ihcUvDhuXLc3sJiqd3jMKAY=
Expand Down
Loading