driver: check history capability

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2023-05-26 10:21:48 +02:00
parent 5e2f8bd64a
commit 9b723ece46
6 changed files with 59 additions and 6 deletions

View File

@ -60,6 +60,7 @@ func (d *Driver) Client(ctx context.Context) (*client.Client, error) {
func (d *Driver) Features() map[driver.Feature]bool {
var useContainerdSnapshotter bool
var historyAPI bool
ctx := context.Background()
c, err := d.Client(ctx)
if err == nil {
@ -69,6 +70,7 @@ func (d *Driver) Features() map[driver.Feature]bool {
useContainerdSnapshotter = true
}
}
historyAPI = driver.HistoryAPISupported(ctx, c)
c.Close()
}
return map[driver.Feature]bool{
@ -76,6 +78,7 @@ func (d *Driver) Features() map[driver.Feature]bool {
driver.DockerExporter: useContainerdSnapshotter,
driver.CacheExport: useContainerdSnapshotter,
driver.MultiPlatform: useContainerdSnapshotter,
driver.HistoryAPI: historyAPI,
}
}