mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 09:17:49 +08:00
Merge pull request #337 from tonistiigi/cacheonly-exporter
build: support cacheonly exporter
This commit is contained in:
commit
38f9241316
@ -343,11 +343,13 @@ func toSolveOpt(d driver.Driver, multiDriver bool, opt Options, dl dockerLoadCal
|
|||||||
IsDefaultMobyDriver()
|
IsDefaultMobyDriver()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
noDefaultLoad, _ := strconv.ParseBool(os.Getenv("BUILDX_NO_DEFAULT_LOAD"))
|
||||||
|
|
||||||
switch len(opt.Exports) {
|
switch len(opt.Exports) {
|
||||||
case 1:
|
case 1:
|
||||||
// valid
|
// valid
|
||||||
case 0:
|
case 0:
|
||||||
if isDefaultMobyDriver {
|
if isDefaultMobyDriver && !noDefaultLoad {
|
||||||
// backwards compat for docker driver only:
|
// backwards compat for docker driver only:
|
||||||
// this ensures the build results in a docker image.
|
// this ensures the build results in a docker image.
|
||||||
opt.Exports = []client.ExportEntry{{Type: "image", Attrs: map[string]string{}}}
|
opt.Exports = []client.ExportEntry{{Type: "image", Attrs: map[string]string{}}}
|
||||||
@ -382,6 +384,15 @@ func toSolveOpt(d driver.Driver, multiDriver bool, opt Options, dl dockerLoadCal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cacheonly is a fake exporter to opt out of default behaviors
|
||||||
|
exports := make([]client.ExportEntry, 0, len(opt.Exports))
|
||||||
|
for _, e := range opt.Exports {
|
||||||
|
if e.Type != "cacheonly" {
|
||||||
|
exports = append(exports, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
opt.Exports = exports
|
||||||
|
|
||||||
// set up exporters
|
// set up exporters
|
||||||
for i, e := range opt.Exports {
|
for i, e := range opt.Exports {
|
||||||
if (e.Type == "local" || e.Type == "tar") && opt.ImageIDFile != "" {
|
if (e.Type == "local" || e.Type == "tar") && opt.ImageIDFile != "" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user