@@ -139,7 +139,19 @@ func recoverFromReplaceImages() {
139
139
func replaceImages (csv map [string ]interface {}) {
140
140
defer recoverFromReplaceImages ()
141
141
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
143
155
144
156
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 {})
145
157
if ! ok {
@@ -149,10 +161,14 @@ func replaceImages(csv map[string]interface{}) {
149
161
for _ , item := range env {
150
162
variable := item .(map [string ]interface {})
151
163
if variable ["name" ] == "RELATED_IMAGE_OPERATOR" {
152
- variable ["value" ] = FIO_IMAGE_PULLSPEC
164
+ variable ["value" ] = redHatPullSpec
153
165
}
154
166
}
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" )
156
172
}
157
173
158
174
func removeRelated (csv map [string ]interface {}) {
0 commit comments