mirror of
https://github.com/mudler/luet.git
synced 2025-09-03 16:25:19 +00:00
Print warning if container-diffs return errors to stderr
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
package backend
|
package backend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@@ -241,13 +242,20 @@ func (*SimpleDocker) Changes(fromImage, toImage string) ([]compiler.ArtifactLaye
|
|||||||
return []compiler.ArtifactLayer{}, errors.Wrap(err, "Error met while creating tempdir for rootfs")
|
return []compiler.ArtifactLayer{}, errors.Wrap(err, "Error met while creating tempdir for rootfs")
|
||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpdiffs) // clean up
|
defer os.RemoveAll(tmpdiffs) // clean up
|
||||||
|
var errorBuffer bytes.Buffer
|
||||||
|
|
||||||
diffargs := []string{"diff", fromImage, toImage, "-v", "error", "-q", "--type=file", "-j", "-n", "-c", tmpdiffs}
|
diffargs := []string{"diff", fromImage, toImage, "-v", "error", "-q", "--type=file", "-j", "-n", "-c", tmpdiffs}
|
||||||
out, err := exec.Command("container-diff", diffargs...).Output()
|
cmd := exec.Command("container-diff", diffargs...)
|
||||||
|
cmd.Stderr = &errorBuffer
|
||||||
|
out, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []compiler.ArtifactLayer{}, errors.Wrap(err, "Failed Resolving layer diffs: "+string(out))
|
return []compiler.ArtifactLayer{}, errors.Wrap(err, "Failed Resolving layer diffs: "+string(out))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if string(errorBuffer.Bytes()) != "" {
|
||||||
|
Warning("container-diff errored with: " + string(errorBuffer.Bytes()))
|
||||||
|
}
|
||||||
|
|
||||||
if config.LuetCfg.GetGeneral().ShowBuildOutput {
|
if config.LuetCfg.GetGeneral().ShowBuildOutput {
|
||||||
Info(string(out))
|
Info(string(out))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user