mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-29 00:47:42 +08:00
build: avoid warning if default load disabled
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
e24e04be57
commit
0124b6b9c9
@ -343,13 +343,11 @@ 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 && !noDefaultLoad {
|
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{}}}
|
||||||
@ -502,7 +500,7 @@ func Build(ctx context.Context, drivers []DriverInfo, opt map[string]Options, do
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if noMobyDriver != nil {
|
if noMobyDriver != nil && !noDefaultLoad() {
|
||||||
for _, opt := range opt {
|
for _, opt := range opt {
|
||||||
if len(opt.Exports) == 0 {
|
if len(opt.Exports) == 0 {
|
||||||
logrus.Warnf("No output specified for %s driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load", noMobyDriver.Factory().Name())
|
logrus.Warnf("No output specified for %s driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load", noMobyDriver.Factory().Name())
|
||||||
@ -855,6 +853,15 @@ func newDockerLoader(ctx context.Context, d DockerAPI, name string, mw *progress
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func noDefaultLoad() bool {
|
||||||
|
v := os.Getenv("BUILDX_NO_DEFAULT_LOAD")
|
||||||
|
b, err := strconv.ParseBool(v)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Warnf("invalid non-bool value for BUILDX_NO_DEFAULT_LOAD: %s", v)
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
type waitingWriter struct {
|
type waitingWriter struct {
|
||||||
*io.PipeWriter
|
*io.PipeWriter
|
||||||
f func()
|
f func()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user