Skip to content

Conversation

@derekhjray
Copy link
Contributor

Add resumable transport support for pulling images from registry, which is useful for huge image pulling operation, and avoid downloading all image/layer data again when error hanpens

Comment on lines 95 to 115
resume:
if n, err = rb.rc.Read(p); n > 0 {
rb.transferred += int64(n)
}

if err == nil {
return
}

if errors.Is(err, io.EOF) && rb.total >= 0 && rb.transferred == rb.total {
return
}

if err = rb.resume(err); err == nil {
if n == 0 {
// zero bytes read, try reading again with new response.Body
goto resume
}

// already read some bytes from previous response.Body, returns and waits for next Read operation
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid labels and express this as a loop.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I'm not familiar with Github's systems. I'll raise this in a review.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(reopening)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid labels and express this as a loop.

modified

@Subserial
Copy link
Contributor

Thank you for the contribution! I am going to get another person familiar with Docker on our team to look at this change.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 50.31056% with 80 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.01%. Comparing base (8b3c303) to head (17f518a).
⚠️ Report is 55 commits behind head on main.

Files with missing lines Patch % Lines
pkg/v1/remote/transport/resumable.go 50.68% 45 Missing and 27 partials ⚠️
cmd/crane/cmd/pull.go 0.00% 4 Missing ⚠️
pkg/v1/remote/options.go 63.63% 4 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (8b3c303) and HEAD (17f518a). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (8b3c303) HEAD (17f518a)
2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2152       +/-   ##
===========================================
- Coverage   71.67%   53.01%   -18.67%     
===========================================
  Files         123      165       +42     
  Lines        9935    11101     +1166     
===========================================
- Hits         7121     5885     -1236     
- Misses       2115     4482     +2367     
- Partials      699      734       +35     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants