Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-14923

Enhance DELETE API to include multiple build numbers with spaces using separators

    Details

      Description

      The matrix configuration jobs in Jenkins have build numbers that consist of spaces and comma. One example if a build number from a matrix configuration job in jenkins can be 2050 :: LABEL_EXP=universe,MODE=test,PRODUCT=planets, where parent Jenkins build number is 2050.

      The DELETE API is unable to handle this type of build number, during the parsing the moment it finds the comma it thinks the rest of string is another build number. So we get a error "unable to find the given build number". The only option left for the user is to delete builds from the UI.

      Please provide a solution as we have thousands of builds and it becomes very tedious to delete them from the UI. Secondly we have a internal security concerns detailed in case#67849(I am planning to write another feature request to support that).

      I am copying a response from jfrog support below, so that you can recreate the issue.

      *********************************************************************************************************
      Hi Binny

      Those REST API calls are not being processed because of the spaces. Spaces are illegal characters even when using cURL. Those requests are being stopped by Tomcat:

      When I run the following:

      curl -X DELETE -uadmin:password "http://localhost:9091/artifactory/api/build/multi-test?buildNumbers=1 :: default"
      I got:
      Sep 10, 2017 10:38:21 AM org.apache.coyote.http11.AbstractHttp11Processor process
      INFO: Error parsing HTTP request header
      Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
      java.lang.IllegalArgumentException: Invalid character found in the HTTP protocol
      at org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine(AbstractNioInputBuffer.java:336)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1017)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1524)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1480)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)

      However, the following command worked:
      curl -X DELETE -uadmin:password "http://localhost:9091/artifactory/api/build/multi-test?buildNumbers=1%20::%20default"
      The following builds have been deleted successfully: 'multi-test#1 :: default'.
      This build, indeed, was removed.

      I’ve tried with the same information as you:
      I’ve deployed a build with the ID: 3 :: LABEL_EXP=universe,MODE=test,PRODUCT=planets. Upon running this REST API:
      curl -X DELETE -uadmin:password "http://localhost:9091/artifactory/api/build/multi-test?buildNumbers=3 :: LABEL_EXP=universe,MODE=test,PRODUCT=planets"

      Indeed, nothing happened because of the illegal character. However, upon encoding the space, now a different error received:
      "message" : "Unable to find the given build numbers."
      This happens because the “,” character is actually a separator. For Artifactory this means different build numbers:
      3 :: LABEL_EXP=universe
      MODE=test
      PRODUCT=planets

      This is the reason why Artifactory cannot find the build numbers even when spaces are encoded. As you can see in the REST API documentation, this character is a separator:
      “DELETE /api/build/my-build?buildNumbers=51,52,55&artifacts=1
      The following builds has been deleted successfully: 'my-build#51', 'my-build#52', 'my-build#55'.”

      Currently, the only possibility is to remove from the UI. I suggest that you will open a feature request to support this on our public JIRA.

      Best regards,
      Alex
      JFrog Support

      Check your ticket status: #68232

      *********************************************************************************************************

        Attachments

          Activity

            People

            • Assignee:
              tamirh Tamir Hadad
              Reporter:
              binny.dhanjal Binny Dhanjal
              Assigned QA:
              Dudi Morad (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: