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

OLM (v1) docs jq queries result in jq compile error due to backslash

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • 4.15.z, 4.17.z, 4.16.z, 4.18.z, 4.19.z
    • None
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • Moderate
    • None
    • All
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

          The OLM v1 documentation (https://docs.redhat.com/en/documentation/openshift_container_platform/4.19/html-single/extensions/index#olmv1-finding-operators-to-install_managing-ce) provides jq commands for the opm render which will fail with `jq compile errors` due to the backslashes in the command:
      
      opm render \
        registry.redhat.io/redhat/redhat-operator-index:v4.19 \
        | jq -cs '[.[] | select(.schema == "olm.bundle" \
        and (.properties[] | select(.type == "olm.csv.metadata").value.installModes[] \
        | select(.type == "AllNamespaces" and .supported == true)) \
        and .spec.webhookdefinitions == null) | .package] | unique[]'
      jq: error: syntax error, unexpected INVALID_CHARACTER, expecting ';' or ')' at <top-level>, line 1, column 39:
          [.[] | select(.schema == "olm.bundle" \
                                                ^
      jq: error: syntax error, unexpected INVALID_CHARACTER, expecting end of file at <top-level>, line 2, column 81:
            and (.properties[] | select(.type == "olm.csv.metadata").value.installModes[] \
                                                                                          ^
      jq: 2 compile errors

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

          $ opm version  
      Version: version.Version{OpmVersion:"8bcf1556a", GitCommit:"8bcf1556a550efa7bb380ec315c077cf29438695", BuildDate:"2025-08-12T19:51:16Z", GoOs:"darwin", GoArch:"amd64"}
      
      
      Command was exceuted in zsh
      echo $ZSH_VERSION 
      5.9
      

      How reproducible:

          100%

      Steps to Reproduce:

          1. Copy the command from the documentation and replace <catalog_registry_url>:<tag> with an valid endpoint, e.g. registry.redhat.io/redhat/redhat-operator-index:v4.19 
          2. Run command which will always fail
      
          

      Actual results:

          jq compile errors

      Expected results:

          To get a catalog rendered according to the described docs. Executing the command without all the backslash will render the catalog:
      
      opm render \
        registry.redhat.io/redhat/redhat-operator-index:v4.19 \
        | jq -cs '[.[] | select(.schema == "olm.bundle"  
        and (.properties[] | select(.type == "olm.csv.metadata").value.installModes[]  
        | select(.type == "AllNamespaces" and .supported == true))  
        and .spec.webhookdefinitions == null) | .package] | unique[]'
      "3scale-operator"
      "amq-broker-rhel8"
      "amq-broker-rhel9"
      "amq-online"
      "amq-streams"
      "amq-streams-console"
      "amq-streams-proxy"
      "ansible-automation-platform-operator"
      "ansible-cloud-addons-operator"
      "apicast-operator"
      "apicurio-registry-3"
      "authorino-operator"
      "aws-efs-csi-driver-operator"
      "aws-load-balancer-operator"
      "bamoe-kogito-operator"
      "bpfman-operator"
      "cephcsi-operator"
      "cincinnati-operator"
      "cluster-logging"
      "cluster-observability-operator"
      "compliance-operator"
      "container-security-operator"
      "cryostat-operator"
      "das-operator"
      "datagrid"
      "deployment-validation-operator"
      "devspaces"
      "devworkspace-operator"
      "dns-operator"
      "dpu-operator"
      "eap"
      "fence-agents-remediation"
      "file-integrity-operator"
      "gatekeeper-operator-product"
      "gcp-filestore-csi-driver-operator"
      "ingress-node-firewall"
      "jws-operator"
      "kernel-module-management"
      "kiali-ossm"
      "kueue-operator"
      "limitador-operator"
      "logic-operator-rhel8"
      "loki-operator"
      "machine-deletion-remediation"
      "mcg-operator"
      "metallb-operator"
      "netobserv-operator"
      "node-healthcheck-operator"
      "node-maintenance-operator"
      "node-observability-operator"
      "o-cloud-manager"
      "ocs-client-operator"
      "odf-csi-addons-operator"
      "odf-multicluster-orchestrator"
      "odr-cluster-operator"
      "odr-hub-operator"
      "openshift-builds-operator"
      "openshift-cert-manager-operator"
      "openshift-custom-metrics-autoscaler-operator"
      "openshift-external-secrets-operator"
      "openshift-gitops-operator"
      "openshift-pipelines-operator-rh"
      "openshift-zero-trust-workload-identity-manager"
      "opentelemetry-product"
      "pf-status-relay-operator"
      "power-monitoring-operator"
      "quay-bridge-operator"
      "quay-operator"
      "recipe"
      "red-hat-camel-k"
      "rh-service-binding-operator"
      "rhacs-operator"
      "rhcl-operator"
      "rhdh"
      "rhods-operator"
      "rhpam-kogito-operator"
      "rhtas-operator"
      "rhtpa-operator"
      "secrets-store-csi-driver-operator"
      "security-profiles-operator"
      "self-node-remediation"
      "serverless-operator"
      "service-registry-operator"
      "servicemeshoperator"
      "servicemeshoperator3"
      "skupper-netobs-operator"
      "skupper-operator"
      "smb-csi-driver-operator"
      "tang-operator"
      "tempo-product"
      "topology-aware-lifecycle-manager"
      "volsync-product"
      "web-terminal"

      Additional info:

          This issue is not only limited to the provided query. Further queries on the mentioned page (https://docs.redhat.com/en/documentation/openshift_container_platform/4.19/html-single/extensions/index#cluster-extensions) have the same problem.

              rhn-support-mipeter Michael Peter
              rh-ee-kniederw Kevin Niederwanger
              None
              None
              Xia Zhao Xia Zhao
              None
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: