Skip to content
Open
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
6 changes: 3 additions & 3 deletions openshift/catalogd/manifests-experimental.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ spec:
type: Image
image:
pollIntervalMinutes: 10
ref: registry.redhat.io/redhat/certified-operator-index:v4.22
ref: registry.redhat.io/redhat/certified-operator-index:ocp-release
---
# Source: olmv1/templates/openshift-catalogs/clustercatalog-openshift-community-operators.yml
apiVersion: olm.operatorframework.io/v1
Expand All @@ -1018,7 +1018,7 @@ spec:
type: Image
image:
pollIntervalMinutes: 10
ref: registry.redhat.io/redhat/community-operator-index:v4.22
ref: registry.redhat.io/redhat/community-operator-index:ocp-release
---
# Source: olmv1/templates/openshift-catalogs/clustercatalog-openshift-redhat-operators.yml
apiVersion: olm.operatorframework.io/v1
Expand All @@ -1031,7 +1031,7 @@ spec:
type: Image
image:
pollIntervalMinutes: 10
ref: registry.redhat.io/redhat/redhat-operator-index:v4.22
ref: registry.redhat.io/redhat/redhat-operator-index:ocp-release
---
# Source: olmv1/templates/mutatingwebhookconfiguration-catalogd-mutating-webhook-configuration.yml
apiVersion: admissionregistration.k8s.io/v1
Expand Down
6 changes: 3 additions & 3 deletions openshift/catalogd/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ spec:
type: Image
image:
pollIntervalMinutes: 10
ref: registry.redhat.io/redhat/certified-operator-index:v4.22
ref: registry.redhat.io/redhat/certified-operator-index:ocp-release
---
# Source: olmv1/templates/openshift-catalogs/clustercatalog-openshift-community-operators.yml
apiVersion: olm.operatorframework.io/v1
Expand All @@ -1017,7 +1017,7 @@ spec:
type: Image
image:
pollIntervalMinutes: 10
ref: registry.redhat.io/redhat/community-operator-index:v4.22
ref: registry.redhat.io/redhat/community-operator-index:ocp-release
---
# Source: olmv1/templates/openshift-catalogs/clustercatalog-openshift-redhat-operators.yml
apiVersion: olm.operatorframework.io/v1
Expand All @@ -1030,7 +1030,7 @@ spec:
type: Image
image:
pollIntervalMinutes: 10
ref: registry.redhat.io/redhat/redhat-operator-index:v4.22
ref: registry.redhat.io/redhat/redhat-operator-index:ocp-release
---
# Source: olmv1/templates/mutatingwebhookconfiguration-catalogd-mutating-webhook-configuration.yml
apiVersion: admissionregistration.k8s.io/v1
Expand Down
25 changes: 25 additions & 0 deletions openshift/default-catalog-consistency/test/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"io/fs"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
Expand Down Expand Up @@ -124,3 +125,27 @@ func ImageNameFromRef(ref string) string {
}
return last
}

// ClusterCatalogVersion queries the cluster's ClusterVersion resource and returns
// the catalog image tag that corresponds to the running OCP release (e.g. "v4.22").
// It tries oc then kubectl. Returns an empty string when the cluster is not
// accessible or the version cannot be parsed.
func ClusterCatalogVersion() string {
for _, cli := range []string{"oc", "kubectl"} {
out, err := exec.Command(cli, "get", "clusterversion", "version",
"-o", "jsonpath={.status.desired.version}").Output()
if err != nil {
continue
}
v := strings.TrimSpace(string(out))
if v == "" {
continue
}
// "4.22.0" or "4.22.0-0.nightly-2026-05-27-…" → "v4.22"
parts := strings.SplitN(v, ".", 3)
if len(parts) >= 2 {
return fmt.Sprintf("v%s.%s", parts[0], parts[1])
}
}
return ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"os"
"strings"
"testing"

. "github.com/onsi/ginkgo/v2"
Expand All @@ -29,9 +30,22 @@ var _ = Describe("OLM-Catalog-Validation", func() {
Expect(images).ToNot(BeEmpty(), "no images found")
authPath := os.Getenv("REGISTRY_AUTH_FILE")

// ocp-release is an OpenShift imagestream tag resolved cluster-side; it cannot be
// pulled directly from the external registry. Resolve it to a concrete tag by
// querying the cluster's ClusterVersion resource (e.g. "v4.22"). If the cluster
// is not accessible the tag stays as-is and the individual tests are skipped.
if catalogVersion := utils.ClusterCatalogVersion(); catalogVersion != "" {
fmt.Fprintf(os.Stderr, "Resolved cluster catalog version: %s\n", catalogVersion)
for i, img := range images {
Comment thread
coderabbitai[bot] marked this conversation as resolved.
if strings.HasSuffix(img, ":ocp-release") {
images[i] = strings.TrimSuffix(img, ":ocp-release") + ":" + catalogVersion
}
}
}

sysCtx := &types.SystemContext{}
if authPath != "" {
fmt.Println("Using registry auth file:", authPath)
fmt.Fprintf(os.Stderr, "Using registry auth file\n")
sysCtx.AuthFilePath = authPath
}

Expand All @@ -40,6 +54,9 @@ var _ = Describe("OLM-Catalog-Validation", func() {
ctx := context.Background()

It(fmt.Sprintf("validates multiarch support for image: %s", name), func() {
if strings.HasSuffix(url, ":ocp-release") {
Skip(fmt.Sprintf("cluster version unavailable; cannot resolve ocp-release tag for %s", url))
}
By(fmt.Sprintf("Validating image: %s", url))
err := check.ImageSupportsMultiArch(
url,
Expand All @@ -50,6 +67,9 @@ var _ = Describe("OLM-Catalog-Validation", func() {
})

It(fmt.Sprintf("validates image: %s", name), func() {
if strings.HasSuffix(url, ":ocp-release") {
Skip(fmt.Sprintf("cluster version unavailable; cannot resolve ocp-release tag for %s", url))
}
By(fmt.Sprintf("Validating image: %s", url))
// Force image resolution to Linux to avoid OS mismatch errors on macOS,
// like: "no image found for architecture 'arm64', OS 'darwin'".
Expand Down
2 changes: 1 addition & 1 deletion openshift/helm/catalogd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ options:
openshift:
enabled: true
catalogs:
version: v4.22
version: ocp-release

# The set of namespaces
namespaces:
Expand Down