Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hack/tools/catalogs/generate-manifests
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ assert-container-runtime
# Check required tools are installed
assert-commands jq

function usage() {
usage() {
print-banner
echo ""
echo "Usage:"
Expand Down
18 changes: 9 additions & 9 deletions hack/tools/catalogs/list-compatible-bundles
Original file line number Diff line number Diff line change
Expand Up @@ -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[]? |
Expand All @@ -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)))
Expand All @@ -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
echo "WARNING: These results may include bundles with webhooks, which are incompatible" >&2
Loading