File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import (
2424 "net/url"
2525 "strings"
2626 "sync/atomic"
27+ "syscall"
2728 "time"
2829
2930 "github.com/google/go-containerregistry/internal/redact"
@@ -436,6 +437,16 @@ func (w *writer) uploadOne(l v1.Layer) error {
436437
437438 ctx := w .context
438439
440+ shouldRetry := func (err error ) bool {
441+ // Various failure modes here, as we're often reading from and writing to
442+ // the network.
443+ if retry .IsTemporary (err ) || errors .Is (err , io .ErrUnexpectedEOF ) || errors .Is (err , syscall .EPIPE ) {
444+ logs .Warn .Printf ("retrying %v" , err )
445+ return true
446+ }
447+ return false
448+ }
449+
439450 tryUpload := func () error {
440451 location , mounted , err := w .initiateUpload (from , mount )
441452 if err != nil {
@@ -495,7 +506,7 @@ func (w *writer) uploadOne(l v1.Layer) error {
495506 Steps : 3 ,
496507 }
497508
498- return retry .Retry (tryUpload , retry . IsTemporary , backoff )
509+ return retry .Retry (tryUpload , shouldRetry , backoff )
499510}
500511
501512type withLayer interface {
You can’t perform that action at this time.
0 commit comments