google / google/go-containerregistry

v1.ImageIndex needs a Blob(Hash) method

Open
#819 3 comments 0 reactions 0 assignees View on GitHub
lifecycle/frozen
Dominant language
Go
Stars
4k
Forks
686
Avg merge
2d 12h
Merged PRs (30d)
26

Description

Given that a descriptor can point to arbitrary content, we need a way to access that content if it doesn't conform to expected media-types. [`layout.layoutIndex`](https://github.com/google/go-containerregistry/blob/6a6302569e968bb450a96bc80af791aa689d53a3/pkg/v1/layout/index.go#L125-L127) already implements this.

We may want to have an option `v1.ImageIndex.Layer(Hash)` as well (and use it for known layer media types), because of how [`MountableLayer`](https://github.com/google/go-containerregistry/blob/6a6302569e968bb450a96bc80af791aa689d53a3/pkg/v1/remote/mount.go#L25) works.

We also need to update a lot of places where we handle `v1.ImageIndex`. A few that spring to mind...

In `mutate`, you can't append non-manifests to an index:
https://github.com/google/go-containerregistry/blob/6a6302569e968bb450a96bc80af791aa689d53a3/pkg/v1/mutate/index.go#L104-L106

In `remote.Write`, we just ignore non-manifests:
https://github.com/google/go-containerregistry/blob/6a6302569e968bb450a96bc80af791aa689d53a3/pkg/v1/remote/write.go#L517-L535

In `remote.MultiWrite`, we return an error:
https://github.com/google/go-containerregistry/blob/6a6302569e968bb450a96bc80af791aa689d53a3/pkg/v1/remote/multi_write.go#L199

In `layout.Write`, we ignore non-manifests: https://github.com/google/go-containerregistry/blob/6a6302569e968bb450a96bc80af791aa689d53a3/pkg/v1/layout/write.go#L261-L263

In `validate.Index`, we log a warning: https://github.com/google/go-containerregistry/blob/6a6302569e968bb450a96bc80af791aa689d53a3/pkg/v1/validate/index.go#L78-L79

In `compare.Indexes`, we don't bother: https://github.com/google/go-containerregistry/blob/6a6302569e968bb450a96bc80af791aa689d53a3/pkg/internal/compare/index.go#L76

Contributor guide

Open the contributing guide

Research direction

Start with pkg/v1/layout/index.go to compare layoutIndex's content access, then inspect the ImageIndex handling in pkg/v1/mutate/index.go, pkg/v1/remote/write.go, pkg/v1/remote/multi_write.go, pkg/v1/layout/write.go, pkg/v1/validate/index.go, and pkg/internal/compare/index.go. First resolve the Blob-versus-Layer API scope; done means the chosen behavior is implemented consistently across these paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
devops, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.