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

Wrong sample command to retrieve the latest version of the Container Security Operator and its channel

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 4.13.z, 4.12.z, 4.14.z, 4.15.z, 4.17.z, 4.16.z, 4.18.z, 4.19.0
    • None
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • Important
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

      There sample command to retrieve the latest version of the Container Security Operator and its channel does not get the latest version info.     

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

      4.12 ~ 4.18    

      How reproducible:

      Always    

      Steps to Reproduce:

          1.Go to https://docs.redhat.com/en/documentation/openshift_container_platform/4.18/html/security_and_compliance/pod-vulnerability-scan#security-pod-scan-cso_pod-vulnerability-scan
          2.Check the command that "Retrieve the latest version of the Container Security Operator and its channel" in step 2
          

      Actual results:

      The sample command is,
      $ oc get packagemanifests container-security-operator \
        -o jsonpath='{range .status.channels[*]}{@.currentCSV} {@.name}{"\n"}{end}' \
        | awk '{print "STARTING_CSV=" $1 " CHANNEL=" $2 }' \
        | sort -nr \
        | head -1    
      
      Try the command without "head -1", 
      $ oc get packagemanifests container-security-operator   -o jsonpath='{range .status.channels[*]}{@.currentCSV
      } {@.name}{"\n"}{end}' | awk '{print "STARTING_CSV=" $1 " CHANNEL=" $2 }'   | sort -nr
      STARTING_CSV=container-security-operator.v3.9.10 CHANNEL=stable-3.9
      STARTING_CSV=container-security-operator.v3.8.15 CHANNEL=stable-3.8
      STARTING_CSV=container-security-operator.v3.7.14 CHANNEL=stable-3.7
      STARTING_CSV=container-security-operator.v3.6.10 CHANNEL=stable-3.6
      STARTING_CSV=container-security-operator.v3.5.7 CHANNEL=quay-v3.5
      STARTING_CSV=container-security-operator.v3.4.7 CHANNEL=quay-v3.4
      STARTING_CSV=container-security-operator.v3.13.4 CHANNEL=stable-3.13
      STARTING_CSV=container-security-operator.v3.12.8 CHANNEL=stable-3.12
      STARTING_CSV=container-security-operator.v3.11.9 CHANNEL=stable-3.11
      STARTING_CSV=container-security-operator.v3.10.9 CHANNEL=stable-3.10

      Expected results:

      Instead of using sort with numeric-sort (sort -n), we should sort it with version-sort (sort -V).

      Additional info:

      So the expected command should be,
      $ oc get packagemanifests container-security-operator \ -o jsonpath='{range .status.channels[*]}{@.currentCSV} {@.name}{"\n"}{end}' \ | awk '{print "STARTING_CSV=" $1 " CHANNEL=" $2 }' \ | sort -Vr \ | head -1    

              ocp-docs-bot OCP DocsBot
              rhn-support-lxia Liang Xia
              None
              None
              Xiaojie Yuan Xiaojie Yuan
              None
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: