Fix printing docker build output if -v is given (#1255)

The current version only prints the docker build output if the build
was successful.
This commit is contained in:
Christian Fetzer 2020-03-08 06:59:58 +01:00 committed by GitHub
parent 2bdb3261a0
commit 671035e1f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,12 +71,14 @@ func (c *Build) BuildImage(source string, image string, dockerfile string) error
}
// Build it!
if err := c.Client.BuildImage(opts); err != nil {
err = c.Client.BuildImage(opts)
log.Debugf("Image %s build output:\n%s", image, outputBuffer)
if err != nil {
return errors.Wrap(err, "Unable to build image. For more output, use -v or --verbose when converting.")
}
log.Infof("Image '%s' from directory '%s' built successfully", image, path.Base(source))
log.Debugf("Image %s build output:\n%s", image, outputBuffer)
return nil
}