mirror of
https://github.com/kubernetes-sigs/kind.git
synced 2025-12-01 07:26:05 +07:00
use ctr content fetch and capture errors
This commit is contained in:
@@ -262,17 +262,11 @@ func (c *buildContext) prePullImagesAndWriteManifests(bits kube.Bits, parsedVers
|
||||
image := image // https://golang.org/doc/faq#closures_and_goroutines
|
||||
fns = append(fns, func() error {
|
||||
if !builtImages.Has(image) {
|
||||
/*
|
||||
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))
|
||||
if err = importer.Pull(image, dockerBuildOsAndArch(c.arch)); err != nil {
|
||||
c.logger.Warnf("Failed to pull %s with error: %v", image, err)
|
||||
runE := exec.RunErrorForError(err)
|
||||
c.logger.Warn(string(runE.Output))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -47,10 +47,8 @@ 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,
|
||||
"ctr", "--namespace=k8s.io", "content", "fetch", "--platform="+platform, image,
|
||||
).SetStdout(ioutil.Discard).SetStderr(ioutil.Discard).Run()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user