diff --git a/hack/tools/catalogs/generate-manifests b/hack/tools/catalogs/generate-manifests index ee1ee97b0..02c48a7ae 100755 --- a/hack/tools/catalogs/generate-manifests +++ b/hack/tools/catalogs/generate-manifests @@ -17,7 +17,7 @@ assert-container-runtime # Check required tools are installed assert-commands jq -function usage() { +usage() { print-banner echo "" echo "Usage:" diff --git a/hack/tools/catalogs/list-compatible-bundles b/hack/tools/catalogs/list-compatible-bundles index 8e0560414..001dd7135 100755 --- a/hack/tools/catalogs/list-compatible-bundles +++ b/hack/tools/catalogs/list-compatible-bundles @@ -45,13 +45,13 @@ done shift $((OPTIND -1)) # Select bundle documents -function select-bundle-documents() { +select-bundle-documents() { jq 'select(.schema == "olm.bundle")' } # Select bundles that declare AllNamespace install mode # or declare nothing at all (older released bundles sans "olm.csv.metadata" property) -function that-support-allnamespace-install-mode() { +that-support-allnamespace-install-mode() { jq 'select( all(.properties[].type; . != "olm.csv.metadata") or (.properties[]? | @@ -65,23 +65,23 @@ function that-support-allnamespace-install-mode() { } # Select bundles without dependencies -function that-dont-have-dependencies() { +that-dont-have-dependencies() { jq 'select(all(.properties[].type; . != "olm.package.required" and . != "olm.gvk.required"))' } # Select the "olm.package" property from the bundles # This contains the packageName and version information -function extract-olm-package-property() { +extract-olm-package-property() { jq '.properties[] | select(.type == "olm.package") |.value' } # Group packages by name and collect versions into an array -function group-versions-by-package-name() { - jq -s 'group_by(.packageName) | map({packageName: .[0].packageName, versions: map(.version)})' | regex_it +group-versions-by-package-name() { + jq -s 'group_by(.packageName) | map({packageName: .[0].packageName, versions: map(.version)})' } # Apply regex on name -function filter-by-regex-if-necessary() { +filter-by-regex-if-necessary() { jq --arg regex "$REGEX" ' if $regex != "" then map(select(.packageName | test($regex))) @@ -90,7 +90,7 @@ function filter-by-regex-if-necessary() { end' } -cat - | select-bundle-documents | that-support-allnamespace-install-mode | that-dont-have-dependencies | group-versions-by-package-name | filter-by-regex-if-necessary +cat - | select-bundle-documents | that-support-allnamespace-install-mode | that-dont-have-dependencies | extract-olm-package-property | group-versions-by-package-name | filter-by-regex-if-necessary echo "NOTE: OLM v1 currently only supports bundles that support AllNamespaces install model, don't have dependencies, and don't contain webhooks" >&2 -echo "WARNING: These results may include bundles with webhooks, which are incompatible" >&2 \ No newline at end of file +echo "WARNING: These results may include bundles with webhooks, which are incompatible" >&2