Skip to content

Commit

Permalink
New --include option for jf search (#1948)
Browse files Browse the repository at this point in the history
* supporting audit with gradle wrapper
  • Loading branch information
sarao1310 authored Jun 11, 2023
1 parent 47635ef commit 2151352
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions artifactory/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -2566,6 +2566,7 @@ func createDefaultSearchSpec(c *cli.Context) (*spec.SpecFiles, error) {
IncludeDirs(c.Bool("include-dirs")).
ArchiveEntries(c.String("archive-entries")).
Transitive(c.Bool("transitive")).
Include(cliutils.GetStringsArrFlagValue(c, "include")).
BuildSpec(), nil
}

Expand Down
8 changes: 8 additions & 0 deletions documentation/CLI-for-JFrog-Artifactory.md
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ This command is used to search and display files in Artifactory.
| --insecure-tls | \[Default: false\]<br><br>Set to true to skip TLS certificates verification. |
| --retries | \[Default: 3\]<br><br>Number of HTTP retry attempts. |
| --retry-wait-time | \[Default: 0s\]<br><br>Number of seconds or milliseconds to wait between retries. The numeric value should either end with s for seconds or ms for milliseconds.retry-wait-time |
| --include | \[Optional\]<br><br> List of fields in the form of \"value1;value2;...\". <br>Only the path and the fields that are specified will be returned. The fields must be part of the 'items' AQL domain. for the full supported items list check [AQL documentation](https://jfrog.com/help/r/jfrog-artifactory-documentation/artifactory-query-language) |
| Command arguments | |
| Search path | Specifies the search path in Artifactory, in the following format: `[repository name]/[repository path].` You can use wildcards to specify multiple artifacts. |

Expand All @@ -578,6 +579,13 @@ Display a list of all zip files located under **/rabbit** in the **frog-repo** r
jf rt s "frog-repo/rabbit/*.zip"
```

##### **Example 3**

Display a list of the files under example-repo-local with the following fields: path, actual_md5, modified_b, updated and depth.
```
jf rt s example-repo-local --include="actual_md5;modified_by;updated;depth"
```

### Setting Properties on Files

This command is used for setting properties on existing files in Artifactory.
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ require (

// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go

// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230608153517-de4a0e58a8cb
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230611135850-d003935e8875

// replace github.com/jfrog/gofrog => github.com/jfrog/gofrog v1.2.6-0.20230418122323-2bf299dd6d27

// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20230608151345-511372c0fe13
replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20230611131847-a3b84a9004c3
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ github.com/jfrog/build-info-go v1.9.6 h1:lCJ2j5uXAlJsSwDe5J8WD7Co1f/hUlZvMfwfb5A
github.com/jfrog/build-info-go v1.9.6/go.mod h1:GbuFS+viHCKZYx9nWHYu7ab1DgQkFdtVN3BJPUNb2D4=
github.com/jfrog/gofrog v1.3.0 h1:o4zgsBZE4QyDbz2M7D4K6fXPTBJht+8lE87mS9bw7Gk=
github.com/jfrog/gofrog v1.3.0/go.mod h1:IFMc+V/yf7rA5WZ74CSbXe+Lgf0iApEQLxRZVzKRUR0=
github.com/jfrog/jfrog-cli-core/v2 v2.35.0 h1:HHc4LZWbN0FnTIY/NJDDGCj0t8PcqbtXVS0zMWjSnGM=
github.com/jfrog/jfrog-cli-core/v2 v2.35.0/go.mod h1:Im3KGsSXuW6AeRyncHyMyGSPl4C8KolqB8apmxW19Ts=
github.com/jfrog/jfrog-client-go v1.30.0 h1:pEUCP0aRxyTIpFkN+jHCkHZF+NNllzpZ2pYJOVSbC2E=
github.com/jfrog/jfrog-client-go v1.30.0/go.mod h1:qEJxoe68sUtqHJ1YhXv/7pKYP/9p1D5tJrruzJKYeoI=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230611135850-d003935e8875 h1:Ix7WQLxWNPuh36vAalOJsHZU6LWvfIKVV3gVpbCeATk=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230611135850-d003935e8875/go.mod h1:Kzh4oTlJu1iYFNQcgAHgKIMvsvgC5LN2DlV/NHWCXZM=
github.com/jfrog/jfrog-client-go v1.28.1-0.20230611131847-a3b84a9004c3 h1:bIpljSo/bnilaRky2mtXcljC0JmONgc97AEy1YG6rXE=
github.com/jfrog/jfrog-client-go v1.28.1-0.20230611131847-a3b84a9004c3/go.mod h1:qEJxoe68sUtqHJ1YhXv/7pKYP/9p1D5tJrruzJKYeoI=
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/jszwec/csvutil v1.8.0 h1:G7vS2LGdpZZDH1HmHeNbxOaJ/ZnJlpwGFvOkTkJzzNk=
Expand Down
7 changes: 6 additions & 1 deletion utils/cliutils/commandsflags.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ const (
deleteQuiet = deletePrefix + quiet

// Unique search flags
searchInclude = "include"
searchPrefix = "search-"
searchRecursive = searchPrefix + recursive
searchProps = searchPrefix + props
Expand Down Expand Up @@ -857,6 +858,10 @@ var flagsMap = map[string]cli.Flag{
Name: transitive,
Usage: "[Default: false] Set to true to look for artifacts also in remote repositories. The search will run on the first five remote repositories within the virtual repository. Available on Artifactory version 7.17.0 or higher.` `",
},
searchInclude: cli.StringFlag{
Name: searchInclude,
Usage: fmt.Sprintf("[Optional] List of fields in the form of \"value1;value2;...\". Only the path and the fields that are specified will be returned. The fields must be part of the 'items' AQL domain. For the full supported items list, check %sjfrog-artifactory-documentation/artifactory-query-language` `", coreutils.JFrogHelpUrl),
},
propsRecursive: cli.BoolTFlag{
Name: recursive,
Usage: "[Default: true] When false, artifacts inside sub-folders in Artifactory will not be affected.` `",
Expand Down Expand Up @@ -1602,7 +1607,7 @@ var commandFlags = map[string][]string{
url, user, password, accessToken, sshPassphrase, sshKeyPath, serverId, ClientCertPath,
ClientCertKeyPath, specFlag, specVars, exclusions, sortBy, sortOrder, limit, offset,
searchRecursive, build, includeDeps, excludeArtifacts, count, bundle, includeDirs, searchProps, searchExcludeProps, failNoOp, archiveEntries,
InsecureTls, searchTransitive, retries, retryWaitTime, project,
InsecureTls, searchTransitive, retries, retryWaitTime, project, searchInclude,
},
Properties: {
url, user, password, accessToken, sshPassphrase, sshKeyPath, serverId, ClientCertPath,
Expand Down

0 comments on commit 2151352

Please sign in to comment.