-
Notifications
You must be signed in to change notification settings - Fork 876
Enable building Windows container images #6592
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
base: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sebsoto The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
0d130f7 to
40ef079
Compare
|
A friendly reminder that this PR had no activity for 30 days. |
|
Ephemeral COPR build failed. @containers/packit-build please check. |
b880025 to
2077e66
Compare
nalind
left a comment
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.
I usually don't look at draft and WIPs, but since you asked.
tests/bud.bats
Outdated
| # Get the last layer digest from the manifest (the layer we just created) | ||
| run jq -r '.layers[-1].digest' ${manifest_file} | ||
| local layer_digest=${output#sha256:} | ||
| local layer_file=${ocidir}/blobs/sha256/${layer_digest} |
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.
There's a oci_image_last_diff() helper function which will probably save a bit of time here.
image.go
Outdated
| return <-w.done | ||
| } | ||
|
|
||
| func newWindowsMutator(outStream io.WriteCloser) *winMutator { |
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.
This duplicates a lot of what makeFilteredLayerWriteCloser() is already doing to create a tar filterer through which the layer diff will be passed. Adding these changes to it will save us the trouble of passing the layer over another pipe.
image.go
Outdated
| } | ||
|
|
||
| if !h.ModTime.IsZero() { | ||
| h.PAXRecords[keyCreationTime] = fmt.Sprintf("%d.%d", h.ModTime.Unix(), h.ModTime.Nanosecond()) |
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 timestamp needs to be clamped as we do elsewhere when the build is meant to be reproducible. The nanosecond value is not zero-padded.
|
Thanks @nalind |
nalind
left a comment
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.
I think that dropping the layerWriter refactor would make this PR considerably smaller, and would hopefully avoid the copy-pasting of functions from elsewhere.
Having the tar filter adjust everything that passes through it (i.e., setting the PAX records and header format) , and having makeFilteredLayerWriteCloser() write the initial Hives/ and Files/ entries through the new WriteCloser before returning it (much as newLayerWriter() would have) would reduce the number of locations where the header changes needed to be made and the desired ModTime determined.
image.go
Outdated
| if windows { | ||
| hdr.Name = filepath.Join("Files", hdr.Name) | ||
| if hdr.Linkname != "" { | ||
| hdr.Linkname = filepath.Join("Files", hdr.Linkname) |
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.
These need to be path.Join(), in case this code is ever natively built for Windows.
b905676 to
25a54a5
Compare
Enables committing a Windows base image as the final layer. This gives the possibility of building a Windows container image on a Linux build system. Only COPY and ADD are in scope. This allows the workflow of cross compiling Windows binaries on Linux, and copying them into a Windows container image for use on Windows systems. Signed-off-by: Sebastian Soto <ssoto@redhat.com>
Finding a clean way to do this has been difficult, as the directories passed through the writer would end up being |
What type of PR is this?
/kind feature
What this PR does / why we need it:
How to verify it
Which issue(s) this PR fixes:
Fixes #4010
Special notes for your reviewer:
Does this PR introduce a user-facing change?