jfrog / jfrog-cli

JFrog CLI is a client that provides a simple interface that automates access to the JFrog products.
https://www.jfrog.com/confluence/display/CLI/JFrog+CLI
Apache License 2.0
531 stars 231 forks source link

Using parenthesis causes wildcard upload to fail on JFrog CLI 2.34.5/6 #1855

Open AndreyGranovsky opened 1 year ago

AndreyGranovsky commented 1 year ago

Describe the bug

"jf rt upload" will not upload multiple artifacts when using parenthesis in the upload command in JFrog CLI version 2.34.5 or 2.34.6. For example, uploading all the files under the current directory to the "generic-local" repository: jf rt u "(*)" "generic-local": { "status": "success", "totals": { "success": 0, "failure": 0 } }

This syntax worked on JFrog CLI version 2.24.2.

Current behavior

When using parenthesis in the upload command with wildcard expression, the upload command will not upload the artifacts.

Reproduction steps

  1. Install JFrog CLI version 2.34.5 or 2.34.6

  2. Create several files for example "test.tgz" "test1.tgz" "test2.tgz"

  3. Test uploading all the .tgz files: *jf rt u "().tgz" "generic-local"** [🔵Info] Log path: path-to-the-log.log { "status": "success", "totals": { "success": 0, "failure": 0 } }

  4. Remove the () from the upload: *jf rt u ".tgz" "generic-local"** [🔵Info] These files were uploaded:

📦 generic-local ├── 📄 test1.tgz ├── 📄 test.tgz └── 📄 test2.tgz

{ "status": "success", "totals": { "success": 3, "failure": 0 } }

  1. Install JFrog CLI version 2.24.2 and test the *jf rt u "().tgz" "generic-local"** command once again, the upload is successful.

WORKAROUND Remove the parenthesis from the upload command or use older version that supports the upload with parenthesis (for example JFrog CLI version 2.24.2).

Expected behavior

The upload will work similar to the examples in the documentation

JFrog CLI version

2.34.5 2.34.6

Operating system type and version

macOS Ventura version 13.2.1

JFrog Artifactory version

No response

JFrog Xray version

No response

UiP9AV6Y commented 2 days ago

the issue seems to be that jf counts the number of placeholders and expects all of them to be "consumed" in the target path

what used to work, but no longer does: source: build/(*)-(*)-(*).txt target: local-something/{3}/{1}/

needs to be rewritten as: source: build/(*)-*-(*).txt target: local-something/{2}/{1}/

the second example still uses a wildcard, but without the placeholder notation, as the target pattern only makes use of two capture groups

the examples in the documentation all work b/c they conveniently consume every placeholder defined.