Skip to content

Commit 2a5fb82

Browse files
authored
Improve error message if pulling fails (#2382)
1 parent 311ed5b commit 2a5fb82

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

runner/internal/shim/docker.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,7 @@ func pullImage(ctx context.Context, client docker.APIClient, taskConfig TaskConf
692692
}
693693

694694
var status bool
695+
pullErrors := make([]string, 0)
695696

696697
scanner := bufio.NewScanner(reader)
697698
for scanner.Scan() {
@@ -709,6 +710,7 @@ func pullImage(ctx context.Context, client docker.APIClient, taskConfig TaskConf
709710
}
710711
if progressRow.Error != "" {
711712
log.Error(ctx, "error pulling image", "name", taskConfig.ImageName, "err", progressRow.Error)
713+
pullErrors = append(pullErrors, progressRow.Error)
712714
}
713715
if strings.HasPrefix(progressRow.Status, "Status:") {
714716
status = true
@@ -731,7 +733,10 @@ func pullImage(ctx context.Context, client docker.APIClient, taskConfig TaskConf
731733
if status && currentBytes == totalBytes {
732734
log.Debug(ctx, "image successfully pulled", "bytes", currentBytes, "bps", speed)
733735
} else {
734-
log.Error(ctx, "image pulling interrupted", "bytes", currentBytes, "total", totalBytes, "bps", speed)
736+
return tracerr.Errorf(
737+
"failed pulling %s: downloaded %d/%d bytes (%s/s), errors: %q",
738+
taskConfig.ImageName, currentBytes, totalBytes, speed, pullErrors,
739+
)
735740
}
736741

737742
err = ctx.Err()

0 commit comments

Comments
 (0)