Skip to content

Commit b3db3f1

Browse files
committed
UPSTREAM: <carry>: Update catalogs for 4.23/5.0
Set catalog image tags to ocp-release and update the default-catalog-consistency test to resolve that imagestream tag to a concrete version (e.g. v4.22) by querying the cluster's ClusterVersion resource via oc/kubectl. Falls back to skipping when the cluster is not accessible. Fixes: OCPBUGS-85828 Assisted-by: Claude Signed-off-by: Todd Short <tshort@redhat.com>
1 parent 3d91cab commit b3db3f1

5 files changed

Lines changed: 52 additions & 7 deletions

File tree

openshift/catalogd/manifests-experimental.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ spec:
10051005
type: Image
10061006
image:
10071007
pollIntervalMinutes: 10
1008-
ref: registry.redhat.io/redhat/certified-operator-index:v4.22
1008+
ref: registry.redhat.io/redhat/certified-operator-index:ocp-release
10091009
---
10101010
# Source: olmv1/templates/openshift-catalogs/clustercatalog-openshift-community-operators.yml
10111011
apiVersion: olm.operatorframework.io/v1
@@ -1018,7 +1018,7 @@ spec:
10181018
type: Image
10191019
image:
10201020
pollIntervalMinutes: 10
1021-
ref: registry.redhat.io/redhat/community-operator-index:v4.22
1021+
ref: registry.redhat.io/redhat/community-operator-index:ocp-release
10221022
---
10231023
# Source: olmv1/templates/openshift-catalogs/clustercatalog-openshift-redhat-operators.yml
10241024
apiVersion: olm.operatorframework.io/v1
@@ -1031,7 +1031,7 @@ spec:
10311031
type: Image
10321032
image:
10331033
pollIntervalMinutes: 10
1034-
ref: registry.redhat.io/redhat/redhat-operator-index:v4.22
1034+
ref: registry.redhat.io/redhat/redhat-operator-index:ocp-release
10351035
---
10361036
# Source: olmv1/templates/mutatingwebhookconfiguration-catalogd-mutating-webhook-configuration.yml
10371037
apiVersion: admissionregistration.k8s.io/v1

openshift/catalogd/manifests.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ spec:
10041004
type: Image
10051005
image:
10061006
pollIntervalMinutes: 10
1007-
ref: registry.redhat.io/redhat/certified-operator-index:v4.22
1007+
ref: registry.redhat.io/redhat/certified-operator-index:ocp-release
10081008
---
10091009
# Source: olmv1/templates/openshift-catalogs/clustercatalog-openshift-community-operators.yml
10101010
apiVersion: olm.operatorframework.io/v1
@@ -1017,7 +1017,7 @@ spec:
10171017
type: Image
10181018
image:
10191019
pollIntervalMinutes: 10
1020-
ref: registry.redhat.io/redhat/community-operator-index:v4.22
1020+
ref: registry.redhat.io/redhat/community-operator-index:ocp-release
10211021
---
10221022
# Source: olmv1/templates/openshift-catalogs/clustercatalog-openshift-redhat-operators.yml
10231023
apiVersion: olm.operatorframework.io/v1
@@ -1030,7 +1030,7 @@ spec:
10301030
type: Image
10311031
image:
10321032
pollIntervalMinutes: 10
1033-
ref: registry.redhat.io/redhat/redhat-operator-index:v4.22
1033+
ref: registry.redhat.io/redhat/redhat-operator-index:ocp-release
10341034
---
10351035
# Source: olmv1/templates/mutatingwebhookconfiguration-catalogd-mutating-webhook-configuration.yml
10361036
apiVersion: admissionregistration.k8s.io/v1

openshift/default-catalog-consistency/test/utils/utils.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"io"
88
"io/fs"
99
"os"
10+
"os/exec"
1011
"path/filepath"
1112
"regexp"
1213
"strings"
@@ -124,3 +125,27 @@ func ImageNameFromRef(ref string) string {
124125
}
125126
return last
126127
}
128+
129+
// ClusterCatalogVersion queries the cluster's ClusterVersion resource and returns
130+
// the catalog image tag that corresponds to the running OCP release (e.g. "v4.22").
131+
// It tries oc then kubectl. Returns an empty string when the cluster is not
132+
// accessible or the version cannot be parsed.
133+
func ClusterCatalogVersion() string {
134+
for _, cli := range []string{"oc", "kubectl"} {
135+
out, err := exec.Command(cli, "get", "clusterversion", "version",
136+
"-o", "jsonpath={.status.desired.version}").Output()
137+
if err != nil {
138+
continue
139+
}
140+
v := strings.TrimSpace(string(out))
141+
if v == "" {
142+
continue
143+
}
144+
// "4.22.0" or "4.22.0-0.nightly-2026-05-27-…" → "v4.22"
145+
parts := strings.SplitN(v, ".", 3)
146+
if len(parts) >= 2 {
147+
return fmt.Sprintf("v%s.%s", parts[0], parts[1])
148+
}
149+
}
150+
return ""
151+
}

openshift/default-catalog-consistency/test/validate/suite_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"os"
7+
"strings"
78
"testing"
89

910
. "github.com/onsi/ginkgo/v2"
@@ -29,6 +30,19 @@ var _ = Describe("OLM-Catalog-Validation", func() {
2930
Expect(images).ToNot(BeEmpty(), "no images found")
3031
authPath := os.Getenv("REGISTRY_AUTH_FILE")
3132

33+
// ocp-release is an OpenShift imagestream tag resolved cluster-side; it cannot be
34+
// pulled directly from the external registry. Resolve it to a concrete tag by
35+
// querying the cluster's ClusterVersion resource (e.g. "v4.22"). If the cluster
36+
// is not accessible the tag stays as-is and the individual tests are skipped.
37+
if catalogVersion := utils.ClusterCatalogVersion(); catalogVersion != "" {
38+
fmt.Println("Resolved cluster catalog version:", catalogVersion)
39+
for i, img := range images {
40+
if strings.HasSuffix(img, ":ocp-release") {
41+
images[i] = strings.TrimSuffix(img, ":ocp-release") + ":" + catalogVersion
42+
}
43+
}
44+
}
45+
3246
sysCtx := &types.SystemContext{}
3347
if authPath != "" {
3448
fmt.Println("Using registry auth file:", authPath)
@@ -40,6 +54,9 @@ var _ = Describe("OLM-Catalog-Validation", func() {
4054
ctx := context.Background()
4155

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

5269
It(fmt.Sprintf("validates image: %s", name), func() {
70+
if strings.HasSuffix(url, ":ocp-release") {
71+
Skip(fmt.Sprintf("cluster version unavailable; cannot resolve ocp-release tag for %s", url))
72+
}
5373
By(fmt.Sprintf("Validating image: %s", url))
5474
// Force image resolution to Linux to avoid OS mismatch errors on macOS,
5575
// like: "no image found for architecture 'arm64', OS 'darwin'".

openshift/helm/catalogd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ options:
1616
openshift:
1717
enabled: true
1818
catalogs:
19-
version: v4.22
19+
version: ocp-release
2020

2121
# The set of namespaces
2222
namespaces:

0 commit comments

Comments
 (0)