Skip to content

Commit a9abc7b

Browse files
Merge pull request #645 from rhmdnd/CMP-3362
CMP-3362: Update bundle images for Red Hat registries
2 parents f9a6bac + f92bdf9 commit a9abc7b

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

bundle-hack/update_csv.go

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

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

144156
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{})
145157
if !ok {
@@ -149,10 +161,14 @@ func replaceImages(csv map[string]interface{}) {
149161
for _, item := range env {
150162
variable := item.(map[string]interface{})
151163
if variable["name"] == "RELATED_IMAGE_OPERATOR" {
152-
variable["value"] = FIO_IMAGE_PULLSPEC
164+
variable["value"] = redHatPullSpec
153165
}
154166
}
155-
fmt.Println("Updated the operator image to use downstream builds")
167+
168+
containersMap := 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{})
169+
containersMap["image"] = redHatPullSpec
170+
171+
fmt.Println("Updated the deployment manifest to use downstream builds")
156172
}
157173

158174
func removeRelated(csv map[string]interface{}) {

0 commit comments

Comments
 (0)