YoavKlein
YoavKlein

Reputation: 2705

Weird behavior in Artifactory download when using JFrog CLI

I found this really weird behavior when using the JFrog CLI for downloading.
Ok let's start from uploading: When I want to upload a complete directory hierarchy, say I have this structure:

root
│
└───Folder1
    └───Folder2
        │   file1
        │   file2
        │   file3
        │
        └───Folder3
                nested1
                nested2
                nested3

And I want to upload the contents of Folder2 (While my location is at root!) and all its subdirectories and files into `MyRepo/MyPath', so my repo will look like:


MyRepo
    └───MyPath
        │   file1
        │   file2
        │   file3
        │
        └───Folder3
                nested1
                nested2
                nested3

If i'll try this:

jfrog rt upload --flat=false Folder1/Folder2/ MyRepo/MyPath/ 

I'll be left with Folder1/Folder2 in my hierarchy in Artifactory, and that's not what I want, so I use placeholders:

I'll execute the following command:

jfrog rt upload --flat=false "Folder1/Folder2/(*)" MyRepo/MyPath/{1} 

That works well, and I can understand the logic: --flat=false is so that the nested* files will remain in the Folder3 directory, whereas the file* files will be in the Folder2 directory, and the placeholders say: Take whatever is in Folder1/Folder2 and copy it to MyRepo/MyPath. Perfect!

Trying to do the inverse, i.e. download, using the same logic: Say I want to download everything under MyPath into Folder1/Folder2 directory I'm at, so i'll get the first structure drawn above, I try this:

jfrog rt download --flat=flase "MyRepo/MyPath/(*)" Folder1/Folder2/{1} 

But that creates a really weird directory structure which I don't even want to draw here. The solution was to use flat=true instead of flat=false which is really unintuitive and not-understood at all. Can someone explain this behavior or at least direct me to whoever in JFrog I need to report this?

Upvotes: 1

Views: 1003

Answers (1)

Eyal Ben Moshe
Eyal Ben Moshe

Reputation: 2425

This is indeed a bug. I have just filed this bug here - https://github.com/jfrog/jfrog-cli/issues/883

The issue is specific to the placeholders feature. JFrog CLI seems to misinterpret the correct definition of --flat, when it is used together with placeholders in the "jfrog rt download" command. I believe this issue will be worked on very soon.

Thanks a lot for sharing this!

Upvotes: 2

Related Questions