"Could not locate artifact" when uploading artifact that already exists?

62 views Asked by At

I'm trying to upload artifacts using the following command:

jf rt upload "/local/dir/" my-repo/path/to/ --recursive --url my.artifactory.server.com --flat --access-token $JFROG_ACCESS_TOKEN 

This works fine if the file doesn't exist in the specified location. But if a file already exists--I want to overwrite it, but I get the following error:

04:42:17 [Warn] [Thread 1] (Attempt 4) - Failure occurred while uploading to https://my.artifactory.server.com/artifactory/my-repo/path/to/file.pdf: server response: 404 Not Found
{
  "errors" : [ {
    "status" : 404,
    "message" : "Could not locate artifact 'my-repo:path/to/file.pdf'."
  } ]
}
04:42:17 [Info] [Thread 1]  executor timeout after 3 attempts with 0 milliseconds wait intervals
04:42:17 [Error] server response: 404 Not Found

I found this answer to the same error that recommended jfrog rt c to store the credentials, but as far as I can tell that's an interactive command and I'm running this in a script so interactive isn't an option.

Is there a way to fix this issue?

Edit: Just tested and I get the same error with jf rt del. I can upload the artifact (if it doesn't already exist) with jf rt upload and I can find it with jf rt s, so it definitely exists. Would this be a permissions issue? Maybe I don't have permissions to delete?

2

There are 2 answers

3
Gajapathi Kimidi On

I configurned CLI with Access Token and it is working fine. I have a file already present now I tried to upload the same file(to override), Also, I have added one more file to check if old and new files are getting uploaded succssfully.

jf rt upload /path/mydirectory/ example-repo-local/new/ --flat
07:56:16 [Info] These files were uploaded:

 example-repo-local
└──  new
    ├──  gradle-wrapper.jar
    └──  maven-wrapper.jar
{
  "status": "success",
  "totals": {
    "success": 2,
    "failure": 0
  }
}

My CLI version is 2.54.0 My Artifactory version is 7.81.2 Maybe you are testing in lower versions of CLI/Artifactory. Before upload After trying to upload existing file

0
jeremywat On

The problem was that I didn't have "delete" permissions to the Artifactory repository. I was able to get those permissions and now it's working as expected.

It's unfortunate that Artifactory doesn't return accurate error codes.