0
votes

I am using an Artifactory server. I am trying to store a folder of third party files in my repo.

I was able to upload a zipfile and explode it so I have my files in MY_REPO/MY_FOLDER/

I am trying to recursively download the contents of the folder using:

jfrog rt dl --recursive MY_REPO/MY_FOLDER

I have enabled debug and I get:

    [Info] Searching items to download...
    [Debug] Searching Artifactory using AQL query:
     items.find({"repo": "MY_REPO","path": {"$ne": "."},"$or": [{"$and":[{"path": {"$match": "MY_FOLDER"},"name": {"$match": "*"}}]},{"$and":[{"path": {"$match": "MY_FOLDER/*"},"name": {"$match": "*"}}]}]}).include("name","repo","path","actual_md5","actual_sha1","size","type","property")
    [Error] Artifactory response: 405 Method Not Allowed

    {
      "status": "failure",
      "totals": {
        "success": 0,
        "failure": 0
      }
    }
    [Error] Download finished with errors. Please review the logs

I have tried variations of MY_FOLDER, MY_FOLDER/, MY_FOLDER/. and with/without recursive. I get the same error.

I know I have permissions because I can upload a file:

jfrog rt u TEST_FILE MY_FOLDER

succeeds just fine. But I can't turn around and pull it down:

jfrog rt dl MY_FOLDER/TEST_FILE

results in:

    [Info] Searching items to download...
    [Debug] Searching Artifactory using AQL query:
     items.find({"repo": "MY_REPO","$or": [{"$and":[{"path": {"$match": "."},"name": {"$match": "MY_FILE"}}]}]}).include("name","repo","path","actual_md5","actual_sha1","size","type","property")
    [Error] Artifactory response: 405 Method Not Allowed

    {
      "status": "failure",
      "totals": {
        "success": 0,
        "failure": 0
      }
    }
    [Error] Download finished with errors. Please review the logs

I'm not certain what isn't working, there's nothing on StackOverflow, JFrog dox or elsewhere with issues using jfrog cli. :(

My jfrog-cli.conf looks like this:

        {
          "artifactory": [
            {
              "url": "https://SITE_NAME:PORT_NUM/artifactory/list/MY_REPO/",
              "user": "USERNAME",
              "serverId": "MY_REPO",
              "isDefault": true,
              "apiKey": "API_KEY_FROM_ARTIFACTORY"
            }
          ],
          "Version": "1"
        }

UPDATED I was running version 1.22.1 for Windows 64-bit. I am now using jfrog cli version 1.34.1 for Windows 64-bit. Per first comment I updated to the latest binary and tried running a search, both with and without MY_FOLDER:

jfrog rt s TEST_FILE and jfrog rt s MY_FOLDER/TEST_FILE

Both return the same results. I enabled DEBUG and with the newer binary I actually seem to get two errors. The older binary just reported the 405 error. The newer one reports a 404 (Not Found) then reports the error as a 405 Method Not Allowed.

[Debug] Sending usage info...
[Info] Searching artifacts...
[Debug] Searching Artifactory using AQL query:
 items.find({"$or":[{"$and":[{"repo":"TEST_FILE","path":{"$match":"*"},"name":{"$match":"*"}}]}]}).include("name","repo","path","actual_md5","actual_sha1","size","type","modified","created","property")
[Debug] Sending HTTP POST request to: https://SITE_NAME:8443/artifactory/list/MY_REPO/api/search/aql
[Debug] Sending HTTP GET request to: https://SITE_NAME:8443/artifactory/list/MY_REPO/api/system/version
[Debug] Artifactory response: 404 Not Found
{
  "errors": [
    {
      "status": 404,
      "message": "File not found."
    }
  ]
}
[Error] Artifactory response: 405 Method Not Allowed

Which is still odd because I'm looking for a file I just uploaded. I even deleted the uploaded file and re-uploaded to verify the newer cli can still upload files. I tried a wildcard search to find all files but it returned the same error.

I can also see the file where it is supposed to be using the Artifactory web interface, and download the file and delete it. So Artifactory knows it's there and I have access to it. :-/

1
What version of the CLI are you using? Whats happens if you search for the file and not download it?Prostagma
I took your advice and updated my client and retested. I also ran a couple of searches. I updated the main question to add the additional info.CodeMonkey23

1 Answers

1
votes

The url in your configuration should only contain the base url of Artifactory, i.e: "SITE_NAME:PORT_NUM/artifactory".

You should provide the directory path in the upload and download commands.

Use the ping command to verify your setup works, then progress from there.

BTW: The reason the upload works but download fails is by coincidence. The upload command just uses the upload REST API which expects a path (which you provided in your config), but the download command first sends a search request that does not expect a path, so it fails.