conformance: skip check (by default) for zero layers in image manifest #421
conformance: skip check (by default) for zero layers in image manifest #421jdolitsky merged 2 commits intoopencontainers:mainfrom
Conversation
bc70029 to
3752917
Compare
|
I really hope to see zero layers come back as a valid manifest. Is it possible to keep these cases to see in the future which registries support these without failing conformance? This matrix should be automatable - opencontainers/image-spec#1025 |
|
Perhaps, a way out could be to just enforce all MUSTs and warn on all SHOULDs, so we know without breaking the spirit of the conformance tests. IINM, this particular test was enforcing that registries that don't accept zero layer manifests are not compliant, whereas the image-spec language has no such language. Also [this](https://github.com/opencontainers/image-spec/blob/main/schema/image-manifest-schema.json#LL30C1-L30C1} needs updating to 0 perhaps. |
|
A simpler variant of what we want to achieve. |
028d12d to
7845d34
Compare
sudo-bmitch
left a comment
There was a problem hiding this comment.
This needs another change to actually apply.
@sajayantony if we want add warnings, I'd be open to that as a separate PR.
cf13c0b to
b7be2d0
Compare
|
Updated the PR with one more commit for a different option. |
|
@sudo-bmitch et al, the two commits can be squashed if we agree with the warning approach. |
|
Borrowed the Warn() from #375, also what appears to be a bugfix |
conformance/setup.go
Outdated
| fmt.Fprintf(colorable.NewColorableStderr(), "\n") | ||
| // print message | ||
| msgcolor := color.New(color.FgMagenta).FprintfFunc() | ||
| msgcolor(colorable.NewColorableStderr(), formatter.Fi(2, "\nWARNING: "+message)) | ||
| fmt.Fprintf(colorable.NewColorableStderr(), "\n") | ||
| // print file:line | ||
| _, file, line, _ := runtime.Caller(1) | ||
| flcolor := color.New(color.FgWhite).FprintfFunc() | ||
| flcolor(colorable.NewColorableStderr(), formatter.Fi(2, "\n")) | ||
| flcolor(colorable.NewColorableStderr(), formatter.Fi(2, "%s:%d\n", file, line)) |
There was a problem hiding this comment.
Wondering if we can simply do this warning with log/fmt package as not to bring in additional go mods?
There was a problem hiding this comment.
We could. However, the colors give important visual feedback IMO.
https://github.com/onsi/ginkgo/blob/master/formatter/formatter_test.go#L51
https://github.com/onsi/ginkgo/blob/master/formatter/formatter.go#L60
^ let me try this instead?
There was a problem hiding this comment.
••
WARNING: image manifest with no layers is not supported
/local/rchincha/go/src/github.com/opencontainers/distribution-spec/conformance/02_push_test.go:366 ••••••••
^ with the right colors still happens.
conformance/setup.go
Outdated
| // print message | ||
| fmt.Fprintf(os.Stderr, formatter.Fi(2, "\n{{magenta}}WARNING: %s\n{{/}}", message)) | ||
| // print file:line | ||
| _, file, line, _ := runtime.Caller(1) | ||
| fmt.Fprintf(os.Stderr, formatter.Fi(2, "\n%s:%d\n", file, line)) |
There was a problem hiding this comment.
some sort of linting issue on these
Error: setup.go:358:2: SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)
level=info msg="File cache stats: 1 entries of total size 12.4KiB"
fmt.Fprintf(os.Stderr, formatter.Fi(2, "\n{{magenta}}WARNING: %s\n{{/}}", message))
^
Error: setup.go:361:2: SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)
fmt.Fprintf(os.Stderr, formatter.Fi(2, "\n%s:%d\n", file, line))
^
```
As per image-spec, since this is a SHOULD (hence recommended) and now turned off by default. https://raw.githubusercontent.com/opencontainers/image-spec/main/manifest.md === layers array of objects Each item in the array MUST be a descriptor. For portability, layers SHOULD have at least one entry. === One can enable this test by setting env var: OCI_SKIP_EMPTY_LAYER_PUSH_TEST=0 Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
emptyLayerManifest is being pushed but not deleted during teardown Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
|
zot/main passes with these changes ••••••••••••••••HTML report was created: /local/rchincha/go/src/github.com/opencontainers/distribution-spec/conformance/report.html Ran 63 of 68 Specs in 0.204 seconds |
|
zot/main instrumented to cause warn passes but with warning •• ••••••••••••••••HTML report was created: /local/rchincha/go/src/github.com/opencontainers/distribution-spec/conformance/report.html Ran 63 of 68 Specs in 0.186 seconds |
opencontainers#421) * conformance: always run but warn if empty layer manifest not supported As per image-spec, since this is a SHOULD (hence recommended) and now turned off by default. https://raw.githubusercontent.com/opencontainers/image-spec/main/manifest.md === layers array of objects Each item in the array MUST be a descriptor. For portability, layers SHOULD have at least one entry. === One can enable this test by setting env var: OCI_SKIP_EMPTY_LAYER_PUSH_TEST=0 Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com> * conformance: delete the empty manifest in teardown emptyLayerManifest is being pushed but not deleted during teardown Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com> --------- Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
As per image-spec, since this is a SHOULD (hence recommended) ...
https://raw.githubusercontent.com/opencontainers/image-spec/main/manifest.md
===
layers array of objects
Each item in the array MUST be a descriptor. For portability, layers SHOULD have at least one entry.
===
Fixes #410