2

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
  • 2
    Can you please share the full logs after you set JFROG_CLI_LOG_LEVEL=DEBUG, and your spec file? – Prostagma Aug 05 '20 at 09:23
  • Thanks for that suggestion, @Prostagma. I tried it and got a little more logging, but nothing that seems to add any insights into the problem. – Jørgen Sivesind Aug 06 '20 at 10:48
  • 1
    The code expects to receive status 204: https://github.com/jfrog/jfrog-client-go/blob/v0.12.0/artifactory/services/delete.go#L110 However, the status received from Artifactory is 200. Could it be that something change the return value from 204 to 200? Does your Artifactory runs behind a proxy? – yahavi Aug 06 '20 at 11:06
  • That explains this. We have a forwarding set up from "https://repo.enonic.com/artifactory/" to "https://repo.enonic.com/". I did try several different configs at first, and ended up getting things to work for search and other commands using "url": "https://repo.enonic.com/artifactory/" in the jfrog-cli.conf file, but when I now removed the "artifactory" path from this config, delete works! Thanks for you help, @yahavi! Problem solved! – Jørgen Sivesind Aug 07 '20 at 08:59
  • @yahavi - Do you want to write this in a comment to get cred for the solution? – Jørgen Sivesind Aug 07 '20 at 09:17
  • @JørgenSivesind I wrote more detailed answer in a comment to whomever encounter this in the future. Please accept it. :) – yahavi Aug 08 '20 at 12:55

1 Answers1

1

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.

yahavi
  • 5,149
  • 4
  • 23
  • 39