images

package
v0.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package images is a generated GoMock package.

Index

Constants

View Source
const (
	// DefaultNamespace is the context path under which all component images
	// will be available in the container registry
	DefaultNamespace = "smithy-security/smithy/images"
	// DefaultRegistry is registry to be used for all the images built by the
	// system
	DefaultRegistry = "ghcr.io"
)

Variables

View Source
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

Functions

This section is empty.

Types

type Builder

type Builder interface {
	Build(ctx context.Context, cr *ComponentRepository) (string, error)
	Report() Report
}

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) 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) Tags

func (cr *ComponentRepository) Tags() []string

Tags returns the default tag of the component 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 CustomImageReport

type CustomImageReport struct {
	Tags          []string          `json:"tags" yaml:"tags"`
	Labels        map[string]string `json:"labels" yaml:"labels"`
	BuildArgs     map[string]string `json:"build_args" yaml:"build_args"`
	ContextPath   string            `json:"context_path" yaml:"context_path"`
	Dockerfile    string            `json:"dockerfile" yaml:"dockerfile"`
	ComponentPath string            `json:"component_path" yaml:"component_path"`
	Platform      string            `json:"platform" yaml:"platform"`
}

CustomImageReport captures all the data related to the building of a custom image build

type ImageRepoProcessor

type ImageRepoProcessor interface {
	Process(repo string) string
}

ImageRepoProcessor is an interface for an object that can modify the repository of a container in an arbitrary way. This is only going to be applied to component images

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

Build mocks base method.

func (*MockBuilder) EXPECT

func (m *MockBuilder) EXPECT() *MockBuilderMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBuilder) Report

func (m *MockBuilder) Report() Report

Report mocks base method.

type MockBuilderMockRecorder

type MockBuilderMockRecorder struct {
	// contains filtered or unexported fields
}

MockBuilderMockRecorder is the mock recorder for MockBuilder.

func (*MockBuilderMockRecorder) Build

func (mr *MockBuilderMockRecorder) Build(ctx, cr any) *gomock.Call

Build indicates an expected call of Build.

func (*MockBuilderMockRecorder) Report

func (mr *MockBuilderMockRecorder) Report() *gomock.Call

Report indicates an expected call of Report.

type MockImageRepoProcessor

type MockImageRepoProcessor struct {
	// contains filtered or unexported fields
}

MockImageRepoProcessor is a mock of ImageRepoProcessor interface.

func NewMockImageRepoProcessor

func NewMockImageRepoProcessor(ctrl *gomock.Controller) *MockImageRepoProcessor

NewMockImageRepoProcessor creates a new mock instance.

func (*MockImageRepoProcessor) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockImageRepoProcessor) Process

func (m *MockImageRepoProcessor) Process(repo string) string

Process mocks base method.

type MockImageRepoProcessorMockRecorder

type MockImageRepoProcessorMockRecorder struct {
	// contains filtered or unexported fields
}

MockImageRepoProcessorMockRecorder is the mock recorder for MockImageRepoProcessor.

func (*MockImageRepoProcessorMockRecorder) Process

Process indicates an expected call of Process.

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

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockResolver) Report

func (m *MockResolver) Report() Report

Report mocks base method.

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.

func (*MockResolverMockRecorder) Report

func (mr *MockResolverMockRecorder) Report() *gomock.Call

Report indicates an expected call of Report.

func (*MockResolverMockRecorder) Resolve

func (mr *MockResolverMockRecorder) Resolve(ctx, imageRef any, options ...any) *gomock.Call

Resolve indicates an expected call of Resolve.

type NoOpImageRepoProcessor

type NoOpImageRepoProcessor struct{}

NoOpImageURLProcessor is a struct that is a no-op image repository processor meant to be used by default by resolvers and builders

func (NoOpImageRepoProcessor) Process

func (n NoOpImageRepoProcessor) Process(repo string) string

Process is a no-op processor for the container image URL

type Report

type Report struct {
	CustomImages   []CustomImageReport `json:"custom_images" yaml:"custom_images"`
	ExternalImages sets.Set[string]    `json:"external_images" yaml:"external_images"`
}

Report is a struct containing metadata about all the operations that a builder performed when processing the images of a component

type ResolutionOptionFn

type ResolutionOptionFn func(*resolutionOptions) error

ResolutionOptionFn is used to define common attributes of all the images of components

func WithImageProcessor

func WithImageProcessor(processor ImageRepoProcessor) ResolutionOptionFn

WithImageProcessor adds a processor that will modify the image in an arbitrary way

func WithImageReplacements

func WithImageReplacements(imageReplacements map[string]string) ResolutionOptionFn

WithImageReplacements sets a map that will be used to replace images before resolving them

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

func WithTags

func WithTags(tags ...string) ResolutionOptionFn

WithTags changes the tag that will be set by default to all the component images

type Resolver

type Resolver interface {
	Resolve(ctx context.Context, imageRef string, options ...ResolutionOptionFn) (string, error)
	Report() Report
}

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.

Directories

Path Synopsis
Package docker is a generated GoMock package.
Package docker is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL