Skip to content

Commit 5426a10

Browse files
committed
CMP-3362: Update bundle images for Red Hat registries
This commit updates the bundle build scripts so that it references images in registry.redhat.io, so that the bundle image will work once it's released. The images won't resolve, and we will use an ImageContentSourcePolicy to replace the image requests to registry.redhat.io with the quay.io references maintained by Konflux. The important part here is that we're using the same SHA as what's proposed in quay.io, so that when the image is mirrored the reference will resolve.
1 parent fc4c2c7 commit 5426a10

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

bundle-hack/update_csv.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,19 @@ func recoverFromReplaceImages() {
140140
func replaceImages(csv map[string]interface{}) {
141141
defer recoverFromReplaceImages()
142142

143-
FIO_IMAGE_PULLSPEC := "quay.io/redhat-user-workloads/ocp-isc-tenant/file-integrity-operator@sha256:148940c5046c11914540b7c9ad872f5b7c1219d2c75d2eeb6d721c9578b9f43a"
143+
// Konflux will automatically update the image sha based on the most
144+
// recent builds. We want to peel off the SHA and append it to the Red
145+
// Hat registry so that the bundle image will work when it's available
146+
// there.
147+
konfluxPullSpec := "quay.io/redhat-user-workloads/ocp-isc-tenant/file-integrity-operator@sha256:148940c5046c11914540b7c9ad872f5b7c1219d2c75d2eeb6d721c9578b9f43a"
148+
delimiter := "@"
149+
parts := strings.Split(konfluxPullSpec, delimiter)
150+
if len(parts) > 2 {
151+
log.Fatalf("Error: Failed to safely determine image SHA from Konflux pull spec: %s", konfluxPullSpec)
152+
}
153+
imageSha := parts[1]
154+
registry := "registry.redhat.io/compliance/openshift-file-integrity-rhel8-operator"
155+
redHatPullSpec := registry + delimiter + imageSha
144156

145157
env, ok := csv["spec"].(map[string]interface{})["install"].(map[string]interface{})["spec"].(map[string]interface{})["deployments"].([]interface{})[0].(map[string]interface{})["spec"].(map[string]interface{})["template"].(map[string]interface{})["spec"].(map[string]interface{})["containers"].([]interface{})[0].(map[string]interface{})["env"].([]interface{})
146158
if !ok {
@@ -150,7 +162,7 @@ func replaceImages(csv map[string]interface{}) {
150162
for _, item := range env {
151163
variable := item.(map[string]interface{})
152164
if variable["name"] == "RELATED_IMAGE_OPERATOR" {
153-
variable["value"] = FIO_IMAGE_PULLSPEC
165+
variable["value"] = redHatPullSpec
154166
}
155167
}
156168
fmt.Println("Updated the operator image to use downstream builds")

0 commit comments

Comments
 (0)