Skip to content

Commit 822f496

Browse files
authored
Merge pull request #3162 from BenTheElder/ctr-fetch
use ctr content fetch and capture errors
2 parents 5a8ab4a + bc2cacf commit 822f496

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

pkg/build/nodeimage/buildcontext.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -262,17 +262,11 @@ func (c *buildContext) prePullImagesAndWriteManifests(bits kube.Bits, parsedVers
262262
image := image // https://golang.org/doc/faq#closures_and_goroutines
263263
fns = append(fns, func() error {
264264
if !builtImages.Has(image) {
265-
/*
266-
TODO: show errors when we have real errors. See comments in
267-
importer implementation
268-
err := importer.Pull(image, dockerBuildOsAndArch(c.arch))
269-
if err != nil {
270-
c.logger.Warnf("Failed to pull %s with error: %v", image, err)
271-
runE := exec.RunErrorForError(err)
272-
c.logger.Warn(string(runE.Output))
273-
}
274-
*/
275-
_ = importer.Pull(image, dockerBuildOsAndArch(c.arch))
265+
if err = importer.Pull(image, dockerBuildOsAndArch(c.arch)); err != nil {
266+
c.logger.Warnf("Failed to pull %s with error: %v", image, err)
267+
runE := exec.RunErrorForError(err)
268+
c.logger.Warn(string(runE.Output))
269+
}
276270
}
277271
return nil
278272
})

pkg/build/nodeimage/imageimporter.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ func (c *containerdImporter) End() error {
4747
}
4848

4949
func (c *containerdImporter) Pull(image, platform string) error {
50-
// TODO: this should exist with a --no-unpack and some way to operate quietly
51-
// without discarding output
5250
return c.containerCmder.Command(
53-
"ctr", "--namespace=k8s.io", "images", "pull", "--platform="+platform, image,
51+
"ctr", "--namespace=k8s.io", "content", "fetch", "--platform="+platform, image,
5452
).SetStdout(ioutil.Discard).SetStderr(ioutil.Discard).Run()
5553
}
5654

0 commit comments

Comments
 (0)