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

@ -229,11 +229,18 @@ func (d *Driver) Factory() driver.Factory {
}
func (d *Driver) Features() map[driver.Feature]bool {
var historyAPI bool
ctx := context.Background()
c, err := d.Client(ctx)
if err == nil {
historyAPI = driver.HistoryAPISupported(ctx, c)
c.Close()
}
return map[driver.Feature]bool{
driver.OCIExporter: true,
driver.DockerExporter: d.DockerAPI != nil,
driver.CacheExport: true,
driver.MultiPlatform: true, // Untested (needs multiple Driver instances)
driver.CacheExport: true,
driver.MultiPlatform: true, // Untested (needs multiple Driver instances)
driver.HistoryAPI: historyAPI,
}
}