-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support local tarball for nydusify copy #1612
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1612 +/- ##
==========================================
- Coverage 61.29% 61.28% -0.01%
==========================================
Files 146 146
Lines 48143 48143
Branches 46110 46110
==========================================
- Hits 29509 29506 -3
- Misses 17074 17075 +1
- Partials 1560 1562 +2 |
source := sourceNamed.String() | ||
target := targetNamed.String() | ||
var source string | ||
if strings.HasPrefix(opt.Source, "file:///") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use url.Parse
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When given an absolute path, if we use url.Parse
, it incorrectly resolves it into URL.host
instead of URL.path
. So as an alternative, I've referenced helm and added a function getLocalPath(). A detailed description of this function is in the second commit.
return err | ||
} | ||
defer f.Close() | ||
decompressor, err := compression.DecompressStream(f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decompressor
should be closed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved.
} | ||
|
||
if len(images) != 1 { | ||
return "", errors.New("importing multiple images") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should support multi platforms image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The length of images
array represents the number of images in the tarball, not manifests. As shown in the figure, there are two images airpine
and nginx
in the tarball, each of which is multi platform image storing multiple manifests (linux/amd64
and linux/arm64/v8
).
Since all of our exported tarball will only contain 1 image and it's manifests, it can be assumed that if the length of images
in the tarball is greater than 1, the tarball is not formatted correctly.
So maybe this code doesn't need to be changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the detail, LGTM.
Please add test case in |
Also add a doc about |
85d8fbe
to
57740b6
Compare
Done. |
The E2E test process is designed as follows:
|
1c012cb
to
269831f
Compare
Since |
Signed-off-by: BruceAko <[email protected]>
Signed-off-by: BruceAko <[email protected]>
Signed-off-by: BruceAko <[email protected]>
Signed-off-by: BruceAko <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for the work.
Relevant Issue
#1592
Details
proposal:
https://www.yuque.com/chongzhi-rrdux/qn22ch/rolbzm0xe00g1a3b
implement:
https://www.yuque.com/chongzhi-rrdux/qn22ch/tgg8w0rcazmyoo8f
Types of changes
Checklist