@@ -216,22 +216,23 @@ func loadUpdatePayloadMetadata(dir, releaseImage string) (*Update, []payloadTask
216
216
releaseDir = filepath .Join (dir , ReleaseManifestDir )
217
217
)
218
218
219
- // XXX: load cincinnatiJSONFile
220
- cjf := filepath .Join (releaseDir , cincinnatiJSONFile )
221
- // XXX: load imageReferencesFile
222
- irf := filepath .Join (releaseDir , imageReferencesFile )
223
- imageRefData , err := ioutil .ReadFile (irf )
219
+ imageRef , err := loadImageReferences (releaseDir )
224
220
if err != nil {
225
221
return nil , nil , err
226
222
}
227
223
228
- imageRef , err := resourceread .ReadImageStreamV1 (imageRefData )
229
- if err != nil {
230
- return nil , nil , errors .Wrapf (err , "invalid image-references data %s" , irf )
231
- }
224
+ tasks := getPayloadTasks (releaseDir , cvoDir , releaseImage )
225
+
226
+ return & Update {ImageRef : imageRef , ReleaseImage : releaseImage , ReleaseVersion : imageRef .Name }, tasks , nil
227
+ }
228
+
229
+ func getPayloadTasks (releaseDir , cvoDir , releaseImage string ) []payloadTasks {
230
+ cjf := filepath .Join (releaseDir , cincinnatiJSONFile )
231
+ irf := filepath .Join (releaseDir , imageReferencesFile )
232
232
233
233
mrc := manifestRenderConfig {ReleaseImage : releaseImage }
234
- tasks := []payloadTasks {{
234
+
235
+ return []payloadTasks {{
235
236
idir : cvoDir ,
236
237
preprocess : func (ib []byte ) ([]byte , error ) { return renderManifest (mrc , ib ) },
237
238
skipFiles : sets .NewString (),
@@ -240,5 +241,19 @@ func loadUpdatePayloadMetadata(dir, releaseImage string) (*Update, []payloadTask
240
241
preprocess : nil ,
241
242
skipFiles : sets .NewString (cjf , irf ),
242
243
}}
243
- return & Update {ImageRef : imageRef , ReleaseImage : releaseImage , ReleaseVersion : imageRef .Name }, tasks , nil
244
+ }
245
+
246
+ func loadImageReferences (releaseDir string ) (* imagev1.ImageStream , error ) {
247
+ irf := filepath .Join (releaseDir , imageReferencesFile )
248
+ imageRefData , err := ioutil .ReadFile (irf )
249
+ if err != nil {
250
+ return nil , err
251
+ }
252
+
253
+ imageRef , err := resourceread .ReadImageStreamV1 (imageRefData )
254
+ if err != nil {
255
+ return nil , errors .Wrapf (err , "invalid image-references data %s" , irf )
256
+ }
257
+
258
+ return imageRef , nil
244
259
}
0 commit comments