quiet output

This commit is contained in:
Benjamin Elder
2021-04-29 15:59:45 -07:00
parent 950a319187
commit af8c82b8fe
2 changed files with 16 additions and 8 deletions

View File

@@ -295,13 +295,17 @@ func (c *buildContext) prePullImages(bits kube.Bits, dir, containerID string) ([
image := image // https://golang.org/doc/faq#closures_and_goroutines
fns = append(fns, func() error {
if !builtImages.Has(image) {
err := importer.Pull(image, dockerBuildOsAndArch(c.arch))
if err != nil {
c.logger.Warnf("Failed to pull %s with error: %v", image, err)
runE := exec.RunErrorForError(err)
c.logger.Warn(string(runE.Output))
}
// TODO(bentheelder): generate a friendlier name
/*
TODO: show errors when we have real errors. See comments in
importer implementation
err := importer.Pull(image, dockerBuildOsAndArch(c.arch))
if err != nil {
c.logger.Warnf("Failed to pull %s with error: %v", image, err)
runE := exec.RunErrorForError(err)
c.logger.Warn(string(runE.Output))
}
*/
_ = importer.Pull(image, dockerBuildOsAndArch(c.arch))
}
return nil
})

View File

@@ -17,6 +17,8 @@ limitations under the License.
package nodeimage
import (
"io/ioutil"
"sigs.k8s.io/kind/pkg/exec"
)
@@ -45,9 +47,11 @@ func (c *containerdImporter) End() error {
}
func (c *containerdImporter) Pull(image, platform string) error {
// TODO: this should exist with a --no-unpack and some way to operate quietly
// without discarding output
return c.containerCmder.Command(
"ctr", "--namespace=k8s.io", "images", "pull", "--platform="+platform, image,
).Run()
).SetStdout(ioutil.Discard).SetStderr(ioutil.Discard).Run()
}
func (c *containerdImporter) LoadCommand() exec.Cmd {