Deleting artifacts with JFrog CLI gives "200 OK", but artifacts are not deleted

Viewed 349

I have created an AQL that gives me a number of artifacts I want to delete from Artifactory. I can run a search command with the jfrog-cli on it, and get the correct list of artifacts:

jfrog rt s --spec search-aql.json

When I try to delete the same artifacts with the same AQL, everything seems fine:

  • The artifacts are listed
  • I get a questions of whether to delete them or not.
  • I answer yes, and the command goes on to log the deletion of each item.

Each item seems to be returned and printed to my console, followed by this message:

[Error] Artifactory response: 200 OK

Binaries are also printed to the console, so the console output is really messy.

In the end, I get a summary:

{
  "status": "failure",
  "totals": {
    "success": 0,
    "failure": 68
  }
}
[Error] Artifactory response: 200 OK

With the same user, I can delete individual artifacts using the REST API, so the user does have the necessary rights to do deletion.

I am on version 1.38.2 of the JFrog CLI and 7.2.1 of Artifactory.

Can anybody help me understand what is wrong or how to debug this problem?

Update 2020/08/06: When setting the log level to debug as suggested by @Prostagma, I get two extra lines of logging for each artifact. Here is an example of logging for two artifacts:

[Info] [Thread 1] Deleting <path>/<artifact>.jar.sha512
[Debug] Sending HTTP DELETE request to: https://repo.enonic.com/<path>/<artifact>.jar.sha512
[Error] Artifactory response: 200 OK
<sha512 hash>
[Info] [Thread 0] Deleting <path>/<artifact>.jar
[Debug] Sending HTTP DELETE request to: https://repo.enonic.com/<path>/<artifact>.jar
[Error] Artifactory response: 200 OK
<binary contents of <artifact>.jar
1 Answers

More detailed answer to whomever encounter this issue in the future -

By diving into the code we can see that the CLI expects to get status 204 from Artifactory after deletion: https://github.com/jfrog/jfrog-client-go/blob/v0.12.0/artifactory/services/delete.go#L110

In some installations, there may be a proxy that changes the response codes, for example when Artifactory returns 204, it may change the status code to 200.

Please make sure that your proxy doesn't change the status codes returned from Artifactory.

Related