Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-75936

GetRelease() fails when release field is numeric in CSV spec

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 4.22
    • OLM
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • Moderate
    • None
    • None
    • None
    • Rejected
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

          When the release field in a ClusterServiceVersion spec is specified as a numeric value (e.g., 0.20250104), "opm render" returns a JSON unmarshal error.
      
      The GetRelease() function in pkg/registry/csv.go attempts to unmarshal the JSON value directly into a string type variable. When the release is a numeric value, it is parsed as a float rather than a string, causing a type mismatch error.

      Version-Release number of selected component (if applicable):

          xzha@xzha1-mac operator-registry % opm version
      Version: version.Version{OpmVersion:"v1.63.0-1-g9fa4d9b6", GitCommit:"9fa4d9b6", BuildDate:"2026-02-05T03:20:55Z", GoOs:"darwin", GoArch:"arm64"}

      How reproducible:

          always

      Steps to Reproduce:

          1. Create a CSV with a numeric release field in the spec
      
      version: 1.0.1
      release: 20250104
      
          2. run opm render
      xzha@xzha1-mac operator-registry % opm render quay.io/olmqe/nginxolm-operator-bundle:1.0.1-20250104-nginxolm87307 -o yaml
      2026/02/05 14:42:52 render reference "quay.io/olmqe/nginxolm-operator-bundle:1.0.1-20250104-nginxolm87307": failed to derive properties: json: cannot unmarshal number into Go value of type string
      
           3.
          

      Actual results:

          xzha@xzha1-mac operator-registry % opm render quay.io/olmqe/nginxolm-operator-bundle:1.0.1-20250104-nginxolm87307 -o yaml
      2026/02/05 14:42:52 render reference "quay.io/olmqe/nginxolm-operator-bundle:1.0.1-20250104-nginxolm87307": failed to derive properties: json: cannot unmarshal number into Go value of type string

      Expected results:

          no such error

      Additional info:

          

              rh-ee-jkeister Jordan Keister
              rhn-support-xzha Xia Zhao
              None
              None
              Xia Zhao Xia Zhao
              None
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: