mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 00:47:48 +08:00
avoid double pushing with docker driver with containerd
In this mode buildkit can push directly so pushing manually with docker would result in pushing image twice. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
62f5cc7c80
commit
4f7d145c0e
@ -539,7 +539,7 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opts map[
|
|||||||
node := dp.Node().Driver
|
node := dp.Node().Driver
|
||||||
if node.IsMobyDriver() {
|
if node.IsMobyDriver() {
|
||||||
for _, e := range so.Exports {
|
for _, e := range so.Exports {
|
||||||
if e.Type == "moby" && e.Attrs["push"] != "" {
|
if e.Type == "moby" && e.Attrs["push"] != "" && !node.Features(ctx)[driver.DirectPush] {
|
||||||
if ok, _ := strconv.ParseBool(e.Attrs["push"]); ok {
|
if ok, _ := strconv.ParseBool(e.Attrs["push"]); ok {
|
||||||
pushNames = e.Attrs["name"]
|
pushNames = e.Attrs["name"]
|
||||||
if pushNames == "" {
|
if pushNames == "" {
|
||||||
|
@ -420,6 +420,7 @@ func (d *Driver) Features(ctx context.Context) map[driver.Feature]bool {
|
|||||||
driver.DockerExporter: true,
|
driver.DockerExporter: true,
|
||||||
driver.CacheExport: true,
|
driver.CacheExport: true,
|
||||||
driver.MultiPlatform: true,
|
driver.MultiPlatform: true,
|
||||||
|
driver.DirectPush: true,
|
||||||
driver.DefaultLoad: d.defaultLoad,
|
driver.DefaultLoad: d.defaultLoad,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,7 @@ func (d *Driver) Features(ctx context.Context) map[driver.Feature]bool {
|
|||||||
driver.DockerExporter: useContainerdSnapshotter,
|
driver.DockerExporter: useContainerdSnapshotter,
|
||||||
driver.CacheExport: useContainerdSnapshotter,
|
driver.CacheExport: useContainerdSnapshotter,
|
||||||
driver.MultiPlatform: useContainerdSnapshotter,
|
driver.MultiPlatform: useContainerdSnapshotter,
|
||||||
|
driver.DirectPush: useContainerdSnapshotter,
|
||||||
driver.DefaultLoad: true,
|
driver.DefaultLoad: true,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -7,5 +7,6 @@ const DockerExporter Feature = "Docker exporter"
|
|||||||
|
|
||||||
const CacheExport Feature = "Cache export"
|
const CacheExport Feature = "Cache export"
|
||||||
const MultiPlatform Feature = "Multi-platform build"
|
const MultiPlatform Feature = "Multi-platform build"
|
||||||
|
const DirectPush Feature = "Direct push"
|
||||||
|
|
||||||
const DefaultLoad Feature = "Automatically load images to the Docker Engine image store"
|
const DefaultLoad Feature = "Automatically load images to the Docker Engine image store"
|
||||||
|
@ -238,6 +238,7 @@ func (d *Driver) Features(_ context.Context) map[driver.Feature]bool {
|
|||||||
driver.DockerExporter: d.DockerAPI != nil,
|
driver.DockerExporter: d.DockerAPI != nil,
|
||||||
driver.CacheExport: true,
|
driver.CacheExport: true,
|
||||||
driver.MultiPlatform: true, // Untested (needs multiple Driver instances)
|
driver.MultiPlatform: true, // Untested (needs multiple Driver instances)
|
||||||
|
driver.DirectPush: true,
|
||||||
driver.DefaultLoad: d.defaultLoad,
|
driver.DefaultLoad: d.defaultLoad,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,6 +164,7 @@ func (d *Driver) Features(ctx context.Context) map[driver.Feature]bool {
|
|||||||
driver.DockerExporter: true,
|
driver.DockerExporter: true,
|
||||||
driver.CacheExport: true,
|
driver.CacheExport: true,
|
||||||
driver.MultiPlatform: true,
|
driver.MultiPlatform: true,
|
||||||
|
driver.DirectPush: true,
|
||||||
driver.DefaultLoad: d.defaultLoad,
|
driver.DefaultLoad: d.defaultLoad,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user