Skip to content
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

Expose IndexManifest #286

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cnb_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@
return desc.Annotations, nil
}

func (h *CNBIndex) IndexManifest() (*v1.IndexManifest, error) {
return getIndexManifest(h.ImageIndex)

Check warning on line 127 in cnb_index.go

View check run for this annotation

Codecov / codecov/patch

cnb_index.go#L126-L127

Added lines #L126 - L127 were not covered by tests
}

// setters

func (h *CNBIndex) SetAnnotations(digest name.Digest, annotations map[string]string) (err error) {
Expand Down
99 changes: 99 additions & 0 deletions fakes/image_index.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
package fakes

import (
"github.com/buildpacks/imgutil"
"github.com/google/go-containerregistry/pkg/name"
v1 "github.com/google/go-containerregistry/pkg/v1"
)

var _ imgutil.ImageIndex = ImageIndex{}

type ImageIndex struct {
Manifests []v1.Descriptor
}

// AddManifest implements imgutil.ImageIndex.
func (i ImageIndex) AddManifest(_ v1.Image) {
panic("unimplemented")
}

Check warning on line 18 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L17-L18

Added lines #L17 - L18 were not covered by tests

// Annotations implements imgutil.ImageIndex.
func (i ImageIndex) Annotations(_ name.Digest) (map[string]string, error) {
panic("unimplemented")
}

Check warning on line 23 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L22-L23

Added lines #L22 - L23 were not covered by tests

// Architecture implements imgutil.ImageIndex.
func (i ImageIndex) Architecture(_ name.Digest) (string, error) {
panic("unimplemented")
}

Check warning on line 28 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L27-L28

Added lines #L27 - L28 were not covered by tests

// DeleteDir implements imgutil.ImageIndex.
func (i ImageIndex) DeleteDir() error {
panic("unimplemented")
}

Check warning on line 33 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L32-L33

Added lines #L32 - L33 were not covered by tests

// Inspect implements imgutil.ImageIndex.
func (i ImageIndex) Inspect() (string, error) {
panic("unimplemented")
}

Check warning on line 38 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L37-L38

Added lines #L37 - L38 were not covered by tests

// OS implements imgutil.ImageIndex.
func (i ImageIndex) OS(_ name.Digest) (string, error) {
panic("unimplemented")
}

Check warning on line 43 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L42-L43

Added lines #L42 - L43 were not covered by tests

// OSFeatures implements imgutil.ImageIndex.
func (i ImageIndex) OSFeatures(_ name.Digest) ([]string, error) {
panic("unimplemented")
}

Check warning on line 48 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L47-L48

Added lines #L47 - L48 were not covered by tests

// OSVersion implements imgutil.ImageIndex.
func (i ImageIndex) OSVersion(_ name.Digest) (string, error) {
panic("unimplemented")
}

Check warning on line 53 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L52-L53

Added lines #L52 - L53 were not covered by tests

// Push implements imgutil.ImageIndex.
func (i ImageIndex) Push(_ ...imgutil.IndexOption) error {
panic("unimplemented")
}

Check warning on line 58 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L57-L58

Added lines #L57 - L58 were not covered by tests

// RemoveManifest implements imgutil.ImageIndex.
func (i ImageIndex) RemoveManifest(_ name.Digest) error {
panic("unimplemented")
}

Check warning on line 63 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L62-L63

Added lines #L62 - L63 were not covered by tests

// SaveDir implements imgutil.ImageIndex.
func (i ImageIndex) SaveDir() error {
panic("unimplemented")
}

Check warning on line 68 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L67-L68

Added lines #L67 - L68 were not covered by tests

// SetAnnotations implements imgutil.ImageIndex.
func (i ImageIndex) SetAnnotations(_ name.Digest, _ map[string]string) error {
panic("unimplemented")
}

Check warning on line 73 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L72-L73

Added lines #L72 - L73 were not covered by tests

// SetArchitecture implements imgutil.ImageIndex.
func (i ImageIndex) SetArchitecture(_ name.Digest, _ string) error {
panic("unimplemented")
}

Check warning on line 78 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L77-L78

Added lines #L77 - L78 were not covered by tests

// SetOS implements imgutil.ImageIndex.
func (i ImageIndex) SetOS(_ name.Digest, _ string) error {
panic("unimplemented")
}

Check warning on line 83 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L82-L83

Added lines #L82 - L83 were not covered by tests

// SetVariant implements imgutil.ImageIndex.
func (i ImageIndex) SetVariant(_ name.Digest, _ string) error {
panic("unimplemented")
}

Check warning on line 88 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L87-L88

Added lines #L87 - L88 were not covered by tests

// Variant implements imgutil.ImageIndex.
func (i ImageIndex) Variant(_ name.Digest) (string, error) {
panic("unimplemented")
}

Check warning on line 93 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L92-L93

Added lines #L92 - L93 were not covered by tests

func (i ImageIndex) IndexManifest() (*v1.IndexManifest, error) {
return &v1.IndexManifest{
Manifests: i.Manifests,
}, nil
}

Check warning on line 99 in fakes/image_index.go

View check run for this annotation

Codecov / codecov/patch

fakes/image_index.go#L96-L99

Added lines #L96 - L99 were not covered by tests
1 change: 1 addition & 0 deletions index.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type ImageIndex interface {
Inspect() (string, error)
AddManifest(image v1.Image)
RemoveManifest(digest name.Digest) error
IndexManifest() (*v1.IndexManifest, error)

Push(ops ...IndexOption) error
SaveDir() error
Expand Down