Repository navigation
Remove dependency on github.com/opencontainers/runtime-tools - #305
Conversation
Signed-off-by: Sebastiaan van Stijn <[email protected]>
0fffd32 to
37b64bc
Compare
This copies the implementation that was added in [containerd/nri@e01c004] as an internal package, so that we can remove the dependency on the (largely unmaintained) runtime-tools module, including its dependencies. [containerd/nri@e01c004]: containerd/containerd@e01c004 Co-authored-by: Tianon Gravi <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]>
37b64bc to
6113b94
Compare
There was a problem hiding this comment.
Pull request overview
This PR removes the dependency on github.com/opencontainers/runtime-tools by copying the required OCI spec generator functionality into an internal package, and updating tests and module dependencies accordingly.
Changes:
- Added an internal OCI spec generator implementation (
pkg/runtime-tools/internal/ocigen) that satisfiespkg/runtime-tools/generate.UnderlyingGenerator. - Updated the
pkg/runtime-tools/generatetest suite to use the new internal generator instead ofruntime-tools/generate. - Removed
github.com/opencontainers/runtime-tools(and now-unneeded transitive deps) fromgo.mod/go.sum.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/runtime-tools/internal/ocigen/spec_generator.go | New internal generator implementing the UnderlyingGenerator interface directly over *specs-go.Spec. |
| pkg/runtime-tools/generate/helpers_other.go | Non-Linux stub signature adjusted while keeping behavior unchanged. |
| pkg/runtime-tools/generate/generate_suite_test.go | Tests updated to use internal/ocigen instead of upstream runtime-tools/generate. |
| pkg/adaptation/plugin_other.go | Non-Linux stub signature adjusted while keeping behavior unchanged. |
| go.mod | Drops the github.com/opencontainers/runtime-tools requirement (and an indirect dep). |
| go.sum | Removes checksums for now-unreferenced transitive dependencies. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Thx! @tianon (and "claude my eyes right out" 😂) did most of the work; I could sync back some of the changes to containerd; if we want the packages to be close (it was mostly exporting and some GoDoc added). I kept it internal for now, to not couple containerd more, and the implementation is pretty straightforward, but it's something we could still consider if there's a strong need. |
|
Oh! Somewhat unrelated question, but perhaps @klihub knows I noticed this repo uses ginkgo / gomega in some of the packages; I know there's always polarizing opinions on it (some love it, others hate it). I mostly look at it from a dependency perspective (it tends to come with quite some). I wonder if GinkGo was a deliberate choice for this module, or just something that organically found its way in through a contribution. If there's no strong preference for GinkGo, then I have some branch on my machine that I can dust off that removes it 😅 |
It was a deliberate choice at the time, and a mistake I made, because I didn't know better. TBH (and wrt. your 'polarizing opinion' comment above), I've come to almost/mostly hate it (and with passion) ever since, so I'm now in that camp.
@thaJeztah No, absolutely no strong preference for GinkGo. If you have a branch which reworks the unit tests to get rid of Ginko and gomega, it is more than welcomed as a PR. |
|
Thanks! I can dust off that branch; probably can push it after this one's merged (I'm sure there'll be some conflicts with the
Yeah, I know some repositories that use it, but personally never really got into it. I can see parts that are nice (the code describes what you're testing), but it's very alien to stdlib testing, so always requires a context / mental switch for me. The thing I'm not fond of is that "easy to read the test" comes along with a lot of abstraction, and I've seen examples where a |
We don't use it elsewhere in containerd. If you're okay with removing it, I think we should convert the tests over to use the standard test style. |
github.com/opencontainers/runtime-toolscontainerd#13519This copies the implementation that was added in containerd@e01c004 as an internal package, so that we can remove the dependency on the (largely unmaintained) runtime-tools module, including its dependencies.