Uploaded image for project: 'AI Platform Core Components'
  1. AI Platform Core Components
  2. AIPCC-7756

Midstream matcher regex issues

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Undefined Undefined
    • None
    • None
    • Development Platform
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • DP Sprint 22, DP Sprint 23, DP Sprint 24

      Description of problem:

      The regular expression created by "create_midstream_matcher" in https://gitlab.com/redhat/rhel-ai/wheels/builder/-/blob/main/package_plugins/utils.py does not handle some types of versions correctly, e.g. versions with two digits or post releases. It also accepts suffixes it should not accept.

      Version numbers (base image, wheels, builder, etc):

      v23.27.0

      Steps to Reproduce:

      >>> from package_plugins.utils import create_midstream_matcher
      >>> matcher = create_midstream_matcher()
      # versions with two digits
      >>> matcher("test", "v1.2+rhai1")
      # post versions
      >>> matcher("test", "v1.2.3.post1+rhai1")
      # epoch
      >>> matcher("test", "v0!1.2.3+rhai1")
      
      # regular matchers should NOT accept a suffix.
      >>> matcher("test", "v1.2.3+rhai1.whatever")
      <Version('1.2.3+rhai1.whatever')>
      

      Additional info:

      The regular expression for midstream matcher could be simplified. It could delegate PEP 440 validation and parsing to packaging.version.Version().

      r"^(v\d+.*\+rhai\d+)$"

      or

      rf"^(v\d+.*\+rhai\d+\.{re.escape(accelerator)})$"

       

              rh-ee-myochpaz Michael Yochpaz
              cheimes@redhat.com Christian Heimes
              Emilien Macchi, Shifa Khan
              Antonio's Team
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: