Merge pull request #338 from tonistiigi/load-no-warn

build: avoid warning if default load disabled
pull/297/head v0.4.2
Tõnis Tiigi 4 years ago committed by GitHub
commit fb7b670b76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -340,13 +340,11 @@ func toSolveOpt(d driver.Driver, multiDriver bool, opt Options, dl dockerLoadCal
IsDefaultMobyDriver()
})
noDefaultLoad, _ := strconv.ParseBool(os.Getenv("BUILDX_NO_DEFAULT_LOAD"))
switch len(opt.Exports) {
case 1:
// valid
case 0:
if isDefaultMobyDriver && !noDefaultLoad {
if isDefaultMobyDriver && !noDefaultLoad() {
// backwards compat for docker driver only:
// this ensures the build results in a docker image.
opt.Exports = []client.ExportEntry{{Type: "image", Attrs: map[string]string{}}}
@ -499,7 +497,7 @@ func Build(ctx context.Context, drivers []DriverInfo, opt map[string]Options, do
}
}
if noMobyDriver != nil {
if noMobyDriver != nil && !noDefaultLoad() {
for _, opt := range opt {
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())
@ -852,6 +850,15 @@ func newDockerLoader(ctx context.Context, d DockerAPI, name string, mw *progress
}, 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 {
*io.PipeWriter
f func()

Loading…
Cancel
Save