-
Notifications
You must be signed in to change notification settings - Fork 634
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
Enhance default platform comparision for image shareablity #2810 #2834
Enhance default platform comparision for image shareablity #2810 #2834
Conversation
func isMatchingRuntimePlatform(platform string) bool { | ||
p, err := platforms.Parse(platform) | ||
if err != nil { | ||
return false |
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.
Should we log this error?
return false | |
log.L.WithError(err).Errorf("failed to parse platform") | |
return false |
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 don't think its important to log here, as the Parse will be called elsewhere and be handled. Here it just important to figure out if the image is shareable, if any thing goes wrong it will attempt to create a non-shareable image.
Thanks. can we add a test for |
Will add a test case. |
@ktock |
Maybe we can add a test case here: nerdctl/cmd/nerdctl/builder_build_test.go Line 100 in 265d6b9
|
3735561
to
818d105
Compare
Not sure about the test failures, some of the test seem flaky. |
Test failed on CI: https://github.com/containerd/nerdctl/actions/runs/8026538828/job/21929197370?pr=2834#step:7:13
|
818d105
to
b94ba1f
Compare
Fixed the above docker failed test. |
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
b94ba1f
to
8fcb71e
Compare
The lint error seems to be some sort of caching issue, is it possible to have no-cache option. |
pkg/cmd/builder/build_test.go
Outdated
"testing" | ||
|
||
"github.com/containerd/containerd/platforms" | ||
"gotest.tools/v3/assert" |
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.
Running [/home/runner/golangci-lint-1.55.2-linux-amd64/golangci-lint run --out-format=github-actions --verbose] in [] ...
Error: File is not `gofmt`-ed with `-s` (gofmt)
…#2810 Partially Addresses: containerd#2810 There are cases where --platform flag may be passed during nerdctl build. In such a situation if platform matches the runtime platform the image is shareable. Signed-off-by: Shubhranshu Mahapatra <[email protected]>
8fcb71e
to
f853ab8
Compare
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
@@ -430,6 +438,15 @@ func (c *Cmd) AssertOutNotContains(s string) { | |||
}) | |||
} | |||
|
|||
func (c *Cmd) AssertErrNotContains(s string) { |
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.
Hey @Shubhranshu153
Looks like this is testing stdout (c.AssertOutWithFunc
) and not stderr.
Can you clarify if the intention here was to test stderr?
Partially Addresses: #2810
There are cases where --platform flag may be passed during nerdctl build. In such a situation if platform matches the runtime platform the image is shareable.