[pull] main from open-component-model:main#411
Merged
Conversation
…anifest detection (#2657) #### What this PR does / why we need it Docker manifest v2 (`application/vnd.docker.distribution.manifest.v2+json`) and Docker manifest list (`application/vnd.docker.distribution.manifest.list.v2+json`) were excluded from `isOCICompliantManifest` / `IsOCICompliantMediaType` in both `bindings/go/oci/internal/introspection` and `bindings/go/transfer/internal`. This caused LocalBlob resources with Docker manifest media types to silently bypass the OCI artifact upload path when using `UploadAsOciArtifact` mode during transfer — they were stored as plain local blobs instead. The root cause was a TODO in both functions noting Docker manifests were not yet supported. This PR resolves that TODO by adding the two Docker distribution manifest media type constants (mirroring `oras-go/v2`'s internal definitions, which are not importable) and extending the switch statements to accept them. #### Which issue(s) this PR fixes Internal report: standard `docker manifest` transfer broken in v2 transfer path (`UploadAsOciArtifact` mode). #### Testing ##### How to test the changes ```bash # Unit tests (fast) cd bindings/go/transfer && go test ./internal/... -run "TestIsOCICompliant|TestBuildGraphDefinition_Docker" -v cd bindings/go/oci && go test ./internal/introspection/... -v # Integration test (requires Docker) cd bindings/go/transfer/integration && go test -v -run Test_Integration_TransferDockerManifestLocalBlob_CTFToOCI ``` ##### Verification - [x] I have added/updated tests for my changes (see [Test Requirements](../CONTRIBUTING.md#test-requirements)) - [x] Tests pass locally (`task test` and `task test/integration` if applicable) - [ ] If touching multiple modules, `go work` is enabled (see `go.work`) - [x] My changes do not decrease test coverage - [ ] I have tested the changes locally by running `ocm` --------- Signed-off-by: Jakob Möller <contact@jakob-moeller.com>
…sourceStream (#2723) ## Summary - `UploadResourceStream` previously rejected all references except tagged ones (Form C: `repo:tag`) due to a `ValidateReferenceAsTag()` guard — this blocked digest-only (Form A: `repo@sha256:...`) and OCM tag+digest references (`repo:tag@sha256:...`) from uploading - The guard also made the digest-pinning code added in this branch unreachable: for Form C, `ref.Reference.Reference` is always the tag string (non-empty), so the `if ref.Reference.Reference == ""` pin branch was never entered - Replaced the guard with a tag-or-digest check: only bare repository references with neither tag nor digest are rejected ## Changes - `bindings/go/oci/repository.go`: relax guard from `ValidateReferenceAsTag()` to `ref.Tag == "" && ref.ValidateReferenceAsDigest() != nil` - `bindings/go/oci/repository_test.go`: add `TestRepository_UploadResourceStream` with 4 table-driven cases covering all reference forms ## Test plan - [ ] `go test ./... -count=1` passes in `bindings/go/oci` - [ ] tag-only ref: tag preserved, resource digest applied - [ ] digest-only ref: digest preserved, no tag call issued - [ ] OCM tag+digest ref: both preserved (previously blocked by old guard) - [ ] bare repo ref: rejected with `"can only upload ... if it has a tag or digest"` error --------- Signed-off-by: Jakob Möller <contact@jakob-moeller.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )