Documentation ¶
Index ¶
- Constants
- func FullTag(d v1beta1.Dependency) string
- type Fetcher
- type LocalFetcher
- func (r *LocalFetcher) Fetch(ctx context.Context, ref name.Reference, secrets ...string) (v1.Image, error)
- func (r *LocalFetcher) Head(ctx context.Context, ref name.Reference, secrets ...string) (*v1.Descriptor, error)
- func (r *LocalFetcher) Tags(ctx context.Context, ref name.Reference, secrets ...string) ([]string, error)
- type MockFetcher
- func (m *MockFetcher) Fetch(ctx context.Context, ref name.Reference, secrets ...string) (v1.Image, error)
- func (m *MockFetcher) Head(ctx context.Context, ref name.Reference, secrets ...string) (*v1.Descriptor, error)
- func (m *MockFetcher) Tags(ctx context.Context, ref name.Reference, secrets ...string) ([]string, error)
- type MockOption
- type Resolver
- type ResolverOption
Constants ¶
const (
// DefaultVer effectively defines latest for the semver constraints
DefaultVer = ">=v0.0.0"
)
Variables ¶
This section is empty.
Functions ¶
func FullTag ¶
func FullTag(d v1beta1.Dependency) string
FullTag returns the full image tag "source:version" of the given dependency
Types ¶
type Fetcher ¶
type Fetcher interface { Fetch(ctx context.Context, ref name.Reference, secrets ...string) (v1.Image, error) Head(ctx context.Context, ref name.Reference, secrets ...string) (*v1.Descriptor, error) Tags(ctx context.Context, ref name.Reference, secrets ...string) ([]string, error) }
Fetcher defines how we expect to intract with the Image repository.
type LocalFetcher ¶
type LocalFetcher struct{}
LocalFetcher --
func (*LocalFetcher) Fetch ¶
func (r *LocalFetcher) Fetch(ctx context.Context, ref name.Reference, secrets ...string) (v1.Image, error)
Fetch fetches a package image.
type MockFetcher ¶
type MockFetcher struct {
// contains filtered or unexported fields
}
MockFetcher is an image fetcher that returns its configured values.
func NewMockFetcher ¶
func NewMockFetcher(opts ...MockOption) *MockFetcher
NewMockFetcher constructs a new mock fetcher.
func (*MockFetcher) Fetch ¶
func (m *MockFetcher) Fetch(ctx context.Context, ref name.Reference, secrets ...string) (v1.Image, error)
Fetch returns the configured error.
type MockOption ¶
type MockOption func(*MockFetcher)
MockOption modifies the mock fetcher.
func WithDescriptor ¶
func WithDescriptor(dsc *v1.Descriptor) MockOption
WithDescriptor sets the descriptor for the mock fetcher.
func WithError ¶
func WithError(err error) MockOption
WithError sets the error for the mock fetcher.
func WithImage ¶
func WithImage(img v1.Image) MockOption
WithImage sets the image for the mock fetcher.
func WithTags ¶
func WithTags(tags []string) MockOption
WithTags sets the tags for the mock fetcher.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver --
func NewResolver ¶
func NewResolver(opts ...ResolverOption) *Resolver
NewResolver returns a new Resolver.
func (*Resolver) ResolveDigest ¶
ResolveDigest performs a head request to the configured registry in order to determine if the provided version corresponds to a real tag and what the digest of that tag is.
func (*Resolver) ResolveImage ¶
func (r *Resolver) ResolveImage(ctx context.Context, dep v1beta1.Dependency) (string, v1.Image, error)
ResolveImage resolves the image corresponding to the given v1beta1.Dependency.
func (*Resolver) ResolveTag ¶
ResolveTag resolves the tag corresponding to the given v1beta1.Dependency. TODO(@tnthornton) add a test that flexes resolving constraint versions to the expected target version
type ResolverOption ¶
type ResolverOption func(*Resolver)
ResolverOption modifies the image resolver.
func WithFetcher ¶
func WithFetcher(f Fetcher) ResolverOption
WithFetcher modifies the Resolver and adds the given fetcher.