Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-34350

"everything except" style asset name matchers in cleanup policies no longer work on PostgreSQL

    Details

    • Notability:
      3

      Description

      Objective

      An objective of a cleanup policy may be to cleanup all components which DO NOT MATCH a specific pattern. The elastic search query expression does support this type of pattern as defined at https://www.elastic.co/guide/en/elasticsearch/reference/2.4/query-dsl-regexp-query.html#regexp-syntax.

      The at sign "@" matches any string in its entirety. This could be combined with the intersection and complement above to express “everything except”. For instance:

      @&~(foo.+) # anything except string beginning with "foo"

      Working Example 1

      Using Nexus repo 3.37.0 with OrientDB:

      1. Upload a two Maven component to maven-releases repo with these coordinates:

      g:org.example
      a: test
      v:1.2.3

      g:com.example
      a: test
      v:1.2.3

      2. Create a cleanup policy with the following asset name matcher expression that expresses to cleanup any component name NOT Beginning with "com/example":

      @&~(com/example/.*)
      

      3. In the policy preview, choose maven-releases repo and click the Preview button.
      As Expected: one result, there is a match in the g:org.example, a: test. v:1.2.3 component.

      Working Example 2

      1. In repo 3.37.1 using OrientDB, create a docker-hosted repo listening on port 5666 ( this port chosen only for example, does not affect outcome)

      2. Push some images with two different tags - "stable" and "other":

      docker pull hello-world
      docker login 192.168.2.87:5666
      docker tag hello-world 192.168.2.87:5666/hello-world:stable
      docker tag hello-world 192.168.2.87:5666/hello-world:other
      docker push 192.168.2.87:5666/hello-world:stable
      docker push 192.168.2.87:5666/hello-world:other
      

      3. Create a docker format cleanup policy with the following asset name matcher which expresses DO NOT match any docker component ( tag ) that matches "stable":

      @&~(.*/manifests/stable)
      

      4. use the preview option for the docker-hosted repo -
      As Expected: notice that one docker component is listed, the "other" tagged image.

      Non-Working Example

      Repeat the working examples, except when using 3.40.1 ( our latest release at time of filing this issue ) and using Postgresql database. Either start an instance fresh from new install and repeat steps OR upgrade the existing OrientDB instance used in above tests.

      The result is the negative matchers no longer work - they match zero components in the cleanup policy preview instead of just one. Presumably this is because elastic search queries syntax has been eliminated from use for the cleanup policies due to changes in NEXUS-29452 when now SQL queries against the database are used instead of the former expression syntax.

      Expected

      Previously allowed and working Elasticsearch query DSL expressions for Asset Name matchers should continue to work after migrating from OrientDB to SQL databases or a transparent conversion of the matchers with validation should be implemented to keep the intent of previous matchers working identically.

      If the asset name matcher syntax is no longer https://www.elastic.co/guide/en/elasticsearch/reference/2.4/query-dsl-regexp-query.html#regexp-syntax and now some other format, please document this fully.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            plynch Peter Lynch
            Last Updated By:
            Michael Oliverio Michael Oliverio
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                tigCommentSecurity.panel-title