Skip to content

Windows: Supply windows shim version via file#9019

Merged
samuelkarp merged 1 commit intocontainerd:mainfrom
dcantah:hcsshim-version
Aug 29, 2023
Merged

Windows: Supply windows shim version via file#9019
samuelkarp merged 1 commit intocontainerd:mainfrom
dcantah:hcsshim-version

Conversation

@dcantah
Copy link
Copy Markdown
Member

@dcantah dcantah commented Aug 28, 2023

Somewhat similar to how we supply the version of runc to grab for testing via a file in script/, this change supplies the Windows shim version to build off of via a file in the same directory. This seems like a decent home given it now lives next to the script that pulls and builds the shim to include in our build artifacts/locally.

The motivation behind this change is:

Cut down on unneccessary hcsshim vendorings if no library code for containerd changed. It was somewhat clunky how the Windows builds work today. The Windows shim is developed out of tree at github.com/microsoft/hcsshim. To let containerd know what tag to build the shim off of we'd vendor hcsshim into containerd, and then parse the version string from go.mod, fetch this tag, and then build the shim and include it in our artifacts. As mentioned, often times the vendoring would bring in no actual changes that would affect containerd's usage of hcsshim as a library, and would just serve as a means to bump the version of the containerd shim we should build.

Now this process can be a one line change and we can avoid the possible headaches that come with bumping go.mod (bumping other unrelated deps etc.)

Note

To try and show how this would've faired if this was always the model, here are some of my personal hcsshim bumps that would not have been needed as the changes we wanted were in the shim itself and not any library functionality that changed (although some of them do include changes to exported code, it was not the reason for the bump/containerd doesn't use any of the symbols/functionality):

  1. go.mod: Bump hcsshim to v0.10.0-rc.1 #7284
  2. [Vendor] Update hcsshim to 0.8.18 #5673
  3. go.mod: Bump hcsshim to v0.9.4 #7212
  4. go.mod: Update hcsshim to v0.9.2 #6453 (this brought in some new Windows build version constants as well, but that was not the reason for the bump)
  5. go.mod: Update hcsshim to v0.8.21 #5929

@k8s-ci-robot
Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Comment thread script/setup/hcsshim-version Outdated
Comment thread script/setup/install-runhcs-shim Outdated
@dcantah dcantah marked this pull request as ready for review August 28, 2023 17:29
@dcantah dcantah marked this pull request as draft August 28, 2023 17:29
@dcantah
Copy link
Copy Markdown
Member Author

dcantah commented Aug 28, 2023

cc @kiashok @kevpar. How does this model seem to y'all? I feel like this works fairly well.

Comment thread script/setup/hcsshim-version
Somewhat similar to how we supply the version of runc to grab for testing via
a file in script/, this change supplies the Windows shim version to build off
of via a file in the same directory. This seems like a decent home given it now
lives next to the script that pulls and builds the shim to include in our build
artifacts/locally.

The motivation behind this change is:

Cut down on unneccessary hcsshim vendorings if no library code for containerd
changed. It was some what clunky how the Windows builds work today. The Windows
shim is developed out of tree at github.com/microsoft/hcsshim. To let containerd know
what tag to build the shim off of we'd vendor hcsshim into containerd, and then
parse the version string from go.mod, fetch this tag, and then build the shim and
include it in our artifacts. As mentioned, often times the vendoring would bring in
no actual changes that would affect containerd's usage of hcsshim as a library, and
would just serve as a means to bump the version of the containerd shim we should build.

Now this process can be a one line change and we can avoid the possible headaches that come
with bumping go.mod (bumping other unrelated deps etc.)

Signed-off-by: Danny Canter <[email protected]>
@dcantah dcantah marked this pull request as ready for review August 28, 2023 21:59
@dcantah dcantah requested review from kevpar and thaJeztah August 28, 2023 21:59
Copy link
Copy Markdown
Contributor

@kiashok kiashok left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown
Member

@kevpar kevpar left a comment

Choose a reason for hiding this comment

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

LGTM

Just to clarify, I don't think this will obviate the need for #8903, since that is specifically concerned with getting library packages updated.

@dcantah
Copy link
Copy Markdown
Member Author

dcantah commented Aug 28, 2023

@kevpar Agreed, this was not in response to that. I saw @thaJeztah mention this model and went and did a dive on how many hcsshim vendors this would've saved just from myself. I came to the conclusion this was probably worth it after I got to 4 😅

@samuelkarp samuelkarp merged commit cb532a8 into containerd:main Aug 29, 2023
@thaJeztah
Copy link
Copy Markdown
Member

post-merge LGTM, thank you!!!

Just to clarify, I don't think this will obviate the need for #8903, since that is specifically concerned with getting library packages updated.

Yes, the main goal of this would be to make it more clear that the hcsshim library and runhcs binary are not 1:1 coupled. Similar to containerd itself, the binary version and go library version are not 1:1 coupled, and a change similar to #9020

Being able to update them separately means that runhcs binary updates may be easier to backport to release branches in situations where they don't need an updated version of the library-code.

⚠️ for reviewers; going forward, we should make sure that;

  • if a runhcs update does not require changes to the library code, that the binary update and library (module) update are in separate commits.
  • on the other hand, if they MUST be updated together, for both to be in the same commit (to make clear they must be updated together).

@chrishenzie chrishenzie added the cherry-picked/1.7.x PR commits are cherry-picked into release/1.7 branch label Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-picked/1.7.x PR commits are cherry-picked into release/1.7 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants