Skip to content

Commit e86ca15

Browse files
committed
Fix scheduling metadata to use loaded headers
When templates are loaded via GetTemplate, the memfileHeader and rootfsHeader SetOnce fields were initialized with nil values. Although Fetch() would load the actual headers from storage via NewStorage(), these loaded headers were never propagated back to the SetOnce fields. This caused SchedulingMetadata() to always return nil for templates loaded through the normal path. The fix updates the SetOnce fields with the loaded headers from the Storage objects after they are successfully created, but only when the initial header was nil.
1 parent 8375d6e commit e86ca15

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

packages/orchestrator/pkg/sandbox/template/storage_template.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ func (t *storageTemplate) Fetch(ctx context.Context, buildStore *build.DiffStore
206206
return nil
207207
}
208208

209+
if memHdr == nil {
210+
if err := t.memfileHeader.SetValue(memfileStorage.Header()); err != nil {
211+
return fmt.Errorf("failed to update memfile header: %w", err)
212+
}
213+
}
214+
209215
if err := t.memfile.SetValue(memfileStorage); err != nil {
210216
return fmt.Errorf("failed to set memfile value: %w", err)
211217
}
@@ -243,6 +249,12 @@ func (t *storageTemplate) Fetch(ctx context.Context, buildStore *build.DiffStore
243249
return nil
244250
}
245251

252+
if rootHdr == nil {
253+
if err := t.rootfsHeader.SetValue(rootfsStorage.Header()); err != nil {
254+
return fmt.Errorf("failed to update rootfs header: %w", err)
255+
}
256+
}
257+
246258
if err := t.rootfs.SetValue(rootfsStorage); err != nil {
247259
return fmt.Errorf("failed to set rootfs value: %w", err)
248260
}

0 commit comments

Comments
 (0)