history: add support for exporting multiple and all records

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2025-03-20 18:57:21 -07:00
parent 13ef01196d
commit 45dfb84361
5 changed files with 158 additions and 33 deletions

View File

@ -32,8 +32,23 @@ type Record struct {
StateGroup *localstate.StateGroup `json:"stateGroup,omitempty"`
}
func Export(ctx context.Context, c *client.Client, w io.Writer, records []*Record) error {
store := proxy.NewContentStore(c.ContentClient())
func Export(ctx context.Context, c []*client.Client, w io.Writer, records []*Record) error {
var store content.Store
for _, c := range c {
s := proxy.NewContentStore(c.ContentClient())
if store == nil {
store = s
break
}
store = &nsFallbackStore{
main: store,
fb: s,
}
}
if store == nil {
return errors.New("no buildkit client found")
}
mp := contentutil.NewMultiProvider(store)
desc, err := export(ctx, mp, records)