Implement Archive.apply on Windows#1903
Conversation
|
vendor failures are because |
|
Thanks @darrenstahlmsft, this is very clean! Is there ever a case where the existing |
Signed-off-by: Darren Stahl <[email protected]>
f88c661 to
3eb364d
Compare
|
@dnephin Oops. Silly mistake on my part. Fixed. Thanks. @dmcgowan It would not be used for any container layers on Windows, but I guess the naive snapshotter can be used to manage things other than container layers. I can restructure in a way that the old tar apply can be used as well from the naive snapshotter. |
3eb364d to
539192a
Compare
|
Added a new |
Codecov Report
@@ Coverage Diff @@
## master #1903 +/- ##
=========================================
- Coverage 47.29% 45.8% -1.49%
=========================================
Files 89 91 +2
Lines 8830 9127 +297
=========================================
+ Hits 4176 4181 +5
- Misses 3968 4258 +290
- Partials 686 688 +2
Continue to review full report at Codecov.
|
|
This closes #1678 when merged. |
There was a problem hiding this comment.
Why move above? Is there a reason we would want to do the done check after the blocking call rather than before?
There was a problem hiding this comment.
Not intentional. I moved this when attempting to combine the tar extract loop with Windows apply, but decided against it. I'll move it back where it was.
There was a problem hiding this comment.
Could these privilege calls be done by the caller?
There was a problem hiding this comment.
Certainly could be. Moving it to the client would also mean that the archive.Apply would not need to be aware if it is running isolated or not, which is likely better.
There was a problem hiding this comment.
Do we want to remove this for now based on previous discussion? What would happen if 2 unpacks are happening simultaneously. Personally I would rather not have the archive package know about isolation and privileges and leave that to the higher level caller.
There was a problem hiding this comment.
Yes. I'll remove this for now.
|
I am not familiar enough with links in Windows, does any of the Window's apply code need to be leveraging |
|
This is handled by the layer extraction code in the platform. All paths should be relative to the layer root, rather than full paths, which is why the paths here do not need to be rooted. Edit: Note that the links in this code are not OS links, but rather adding links via the hcsshim layer writer APIs |
Signed-off-by: Darren Stahl <[email protected]>
539192a to
c195ebb
Compare
Codecov Report
@@ Coverage Diff @@
## master #1903 +/- ##
==========================================
- Coverage 47.14% 45.76% -1.38%
==========================================
Files 89 91 +2
Lines 8833 9109 +276
==========================================
+ Hits 4164 4169 +5
- Misses 3981 4250 +269
- Partials 688 690 +2
Continue to review full report at Codecov.
|
| if err != nil { | ||
| return nil, err | ||
| } | ||
| if ahdr.Typeflag != tar.TypeReg || !strings.HasPrefix(ahdr.Name, hdr.Name+":") { |
There was a problem hiding this comment.
Is : safe here because Windows doesn't allow : as part of a file name?
| } | ||
|
|
||
| // fileInfoFromHeader retrieves basic Win32 file information from a tar header, using the additional metadata written by | ||
| // WriteTarFileFromBackupStream. |
There was a problem hiding this comment.
Where is WriteTarFileFromBackupStream?
There was a problem hiding this comment.
Current implementation used by Docker is at https://github.com/Microsoft/go-winio/blob/master/backuptar/tar.go#L119
A second PR to implement the Diff side of archive will include the containerd implementation.
|
A couple questions then LGTM |
|
LGTM |
| // ApplyOptions provides additional options for an Apply operation | ||
| type ApplyOptions struct { | ||
| ParentLayerPaths []string // Parent layer paths used for Windows layer apply | ||
| IsWindowsContainerLayer bool // True if the tar stream to be applied is a Windows Container Layer |
There was a problem hiding this comment.
Would it help to make this more generic? It seems like this should be set via a mediatype or other mechanism.
This implements archive.Apply on Windows. It uses opts similar to
Snapshots.Opt, etc.The current options on Windows are BaseLayers (which is required for all layers except the base layer) and isolation, which is not currently used, but will be enabled in another PR, and is necessary for Windows layer extraction.
I have a local updated version of snapshotter and differ PR that I've tested this against. I'll be pushing that one soon.
The second commit is a temp hack as vndr is deleting the file even though it is referenced. I'll work that out on Monday.
@crosbymichael @stevvooe @dmcgowan @jessvalarezo