Documentation
¶
Overview ¶
Package images is a generated GoMock package.
Index ¶
- Constants
- Variables
- type Builder
- type ComponentRepository
- func (cr *ComponentRepository) Directory() string
- func (cr *ComponentRepository) Name() string
- func (cr *ComponentRepository) Registry() string
- func (cr *ComponentRepository) Repo() string
- func (cr *ComponentRepository) Tag() string
- func (cr *ComponentRepository) Type() v1.ComponentType
- func (cr *ComponentRepository) URL() string
- func (cr *ComponentRepository) URLs() []string
- type MockBuilder
- type MockBuilderMockRecorder
- type MockResolver
- type MockResolverMockRecorder
- type ResolutionOptionFn
- type Resolver
Constants ¶
const ( // DefaultNamespace is the context path under which all component images // will be available in the container registry DefaultNamespace = "smithy-security/smithy" // DefaultRegistry is registry to be used for all the images built by the // system DefaultRegistry = "ghcr.io" // DefaultTag will be used for all the images that will be built by the // system or as the tag implicitly used for any component image reference // that doesn't define its own tag DefaultTag = "latest" )
Variables ¶
var DefaultLabels = map[string]string{
"org.opencontainers.image.source": "https://github.com/smithy-security/smithy",
}
DefaultLabels are going to be added to every container built by the system
var ( // ErrNotAComponentRepo is returns when an image repository doesn't match // the expected format ErrNotAComponentRepo = errors.Errorf("image repository doesn't match the expected component path: <component root directory>/%s/component.yaml", componentPluralisedTypeChoice) )
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface {
Build(ctx context.Context, cr *ComponentRepository) (string, error)
}
Builder is an interface implemented by objects that take an image reference and resolve it to one of the paths in the local file system where the component code base is expected to reside and build the image in a standardised manner. If the component requires some special way of being built, that should be defined in another way and this builder is not expected to provide some extra functionality for the time being
type ComponentRepository ¶
type ComponentRepository struct {
// contains filtered or unexported fields
}
ComponentRepository represents a container image repository of a Smithy component. It also captures metadata such as the directory of the component and allows a caller to get the complete registry, repository and tag URL of the image
func ParseComponentRepository ¶
func ParseComponentRepository(componentPath, imageRef string, options ...ResolutionOptionFn) (*ComponentRepository, *name.Tag, error)
ParseComponentRepository parses the component image repository and verifies that it references a smithy component
func (*ComponentRepository) Directory ¶
func (cr *ComponentRepository) Directory() string
Directory is the complete path to the root of the component It is relative to the root of the repository
func (*ComponentRepository) Name ¶
func (cr *ComponentRepository) Name() string
Name returns the name of the component
func (*ComponentRepository) Registry ¶
func (cr *ComponentRepository) Registry() string
Registry returns the name of the component
func (*ComponentRepository) Repo ¶
func (cr *ComponentRepository) Repo() string
Repo returns the repository of the component image
func (*ComponentRepository) Tag ¶
func (cr *ComponentRepository) Tag() string
Tag returns the default tag of the component image
func (*ComponentRepository) Type ¶
func (cr *ComponentRepository) Type() v1.ComponentType
Type returns the component type of the component
func (*ComponentRepository) URL ¶
func (cr *ComponentRepository) URL() string
URL returns the complete registry, namespace, repository and the default tag of the image
func (*ComponentRepository) URLs ¶
func (cr *ComponentRepository) URLs() []string
URLs returns all the component image URLs, not just the one tagged with the default tag
type MockBuilder ¶
type MockBuilder struct {
// contains filtered or unexported fields
}
MockBuilder is a mock of Builder interface.
func NewMockBuilder ¶
func NewMockBuilder(ctrl *gomock.Controller) *MockBuilder
NewMockBuilder creates a new mock instance.
func (*MockBuilder) Build ¶
func (m *MockBuilder) Build(ctx context.Context, cr *ComponentRepository) (string, error)
Build mocks base method.
func (*MockBuilder) EXPECT ¶
func (m *MockBuilder) EXPECT() *MockBuilderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockBuilderMockRecorder ¶
type MockBuilderMockRecorder struct {
// contains filtered or unexported fields
}
MockBuilderMockRecorder is the mock recorder for MockBuilder.
type MockResolver ¶
type MockResolver struct {
// contains filtered or unexported fields
}
MockResolver is a mock of Resolver interface.
func NewMockResolver ¶
func NewMockResolver(ctrl *gomock.Controller) *MockResolver
NewMockResolver creates a new mock instance.
func (*MockResolver) EXPECT ¶
func (m *MockResolver) EXPECT() *MockResolverMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockResolver) Resolve ¶
func (m *MockResolver) Resolve(ctx context.Context, imageRef string, options ...ResolutionOptionFn) (string, error)
Resolve mocks base method.
type MockResolverMockRecorder ¶
type MockResolverMockRecorder struct {
// contains filtered or unexported fields
}
MockResolverMockRecorder is the mock recorder for MockResolver.
type ResolutionOptionFn ¶
type ResolutionOptionFn func(*resolutionOptions) error
ResolutionOptionFn is used to define common attributes of all the images of components
func WithDefaultTag ¶
func WithDefaultTag(t string) ResolutionOptionFn
WithDefaultTag changes the tag that will be set by defaylt to an image if it doesn't have tag already
func WithExtraTags ¶
func WithExtraTags(tags ...string) ResolutionOptionFn
WithDefaultTag changes the tag that will be set by default to all the component images
func WithNamespace ¶
func WithNamespace(n string) ResolutionOptionFn
WithNamespace changes the namespace used for all the component images
func WithRegistry ¶
func WithRegistry(r string) ResolutionOptionFn
WithRegistry changes the registry that will be used for all the images
type Resolver ¶
type Resolver interface {
Resolve(ctx context.Context, imageRef string, options ...ResolutionOptionFn) (string, error)
}
Resolver is an interface implemented by objects that take an image reference and will make sure that the image becomes available for the local daemon to use and execute it. If the image can't be fetched, an error should be returned, otherwise the renderend image registry, repository and tag are returned.