Documentation
¶
Index ¶
- Constants
- Variables
- func CategoryName(c Category) string
- func LogFileNameFormatter(mod ModuleWithMeta) logging.LogFileNameFormatter
- type BinaryNamer
- type Category
- type ContainerBindMount
- type ContainerCapabilities
- type ContainerSpec
- type ContainerTmpfsMount
- type ContainerVolumeMount
- type Example
- type ExecutionContext
- type Factory
- type Help
- type Helper
- type Initializer
- type JSONStateEncoder
- type Metadata
- func (m *Metadata[T]) Category() Category
- func (m *Metadata[T]) ContainerSpec() *ContainerSpec
- func (m *Metadata[T]) Dependencies() []string
- func (m *Metadata[T]) Execute(ctx ExecutionContext) error
- func (m *Metadata[T]) ID() string
- func (m *Metadata[T]) InputMappings() (mappings map[string]string)
- func (m *Metadata[T]) Name() string
- func (m *Metadata[T]) OutDir() string
- func (m *Metadata[T]) SetModule(mod Module)
- func (m *Metadata[T]) SetName(name string)
- func (m *Metadata[T]) ShouldSkip() bool
- func (m *Metadata[T]) Type() string
- func (m *Metadata[T]) UnmarshalHCL(body hcl.Body, ctx *hcl.EvalContext) hcl.Diagnostics
- func (m *Metadata[T]) UnmarshalJSON(bytes []byte) error
- func (m *Metadata[T]) UnmarshalModuleSpec(val *commonv1.ModuleSpec) error
- func (m *Metadata[T]) Unwrap() Module
- type Module
- type ModuleFactoryFunc
- type ModuleWithMeta
- type Registration
- type RegistrationFunc
- type Repository
- func (s *Repository) Builds() map[string]ModuleWithMeta
- func (s *Repository) Module(moduleType Category, moduleName string) ModuleWithMeta
- func (s *Repository) ModuleByID(id string) ModuleWithMeta
- func (s *Repository) ModulesByCategory(moduleType Category) map[string]ModuleWithMeta
- func (s *Repository) RegisterModules(modules ...ModuleWithMeta)
- func (s *Repository) Tasks() map[string]ModuleWithMeta
- func (s *Repository) Tools() map[string]ModuleWithMeta
- type StateEncoder
- type TestExecutionContext
- func (t TestExecutionContext) BinariesDir() string
- func (t TestExecutionContext) GetState(ctx context.Context, key string) ([]byte, state.Metadata, error)
- func (t TestExecutionContext) Logger() *slog.Logger
- func (t TestExecutionContext) Name() string
- func (t TestExecutionContext) OutDir() string
- func (t TestExecutionContext) SetState(ctx context.Context, key string, value []byte) error
- func (t TestExecutionContext) StdErr() io.Writer
- func (t TestExecutionContext) StdOut() io.Writer
- func (t TestExecutionContext) WorkingDir() string
- type ToolModule
- type TypeRegistry
- func (r *TypeRegistry) Create(moduleCategory Category, moduleType string) (ModuleWithMeta, error)
- func (r *TypeRegistry) CreateFromHCL(moduleCategory Category, moduleType string, body hcl.Body, ...) (ModuleWithMeta, error)
- func (r *TypeRegistry) Inventory() (inventory map[Category][]string)
- func (r *TypeRegistry) RegisterModule(factory Factory)
Constants ¶
View Source
const ( CategoryTool = commonv1.Category_CategoryTool CategoryTask = commonv1.Category_CategoryTask CategoryBuild = commonv1.Category_CategoryBuild CategoryPackage = commonv1.Category_CategoryPackage )
Variables ¶
View Source
var ErrNoSuchModule = errors.New("no such module registered")
Functions ¶
func CategoryName ¶
func LogFileNameFormatter ¶
func LogFileNameFormatter(mod ModuleWithMeta) logging.LogFileNameFormatter
Types ¶
type BinaryNamer ¶
type ContainerBindMount ¶
type ContainerCapabilities ¶
type ContainerSpec ¶
type ContainerSpec struct {
Capabilities *ContainerCapabilities `hcl:"capabilities,block"`
Image string `hcl:"image"`
User string `hcl:"user,optional"`
VolumeMounts []ContainerVolumeMount `hcl:"volume_mount,block"`
TmpfsMounts []ContainerTmpfsMount `hcl:"tmpfs_mount,block"`
BindMounts []ContainerBindMount `hcl:"bind_mount,block"`
Privileged bool `hcl:"privileged,optional"`
}
func (ContainerSpec) Mounts ¶
func (s ContainerSpec) Mounts() []mount.Mount
type ContainerTmpfsMount ¶
type ContainerVolumeMount ¶
type Example ¶
type Example struct {
Spec ModuleWithMeta
Name string
Description string
}
type ExecutionContext ¶
type ExecutionContext interface {
context.Context
Name() string
WorkingDir() string
OutDir() string
BinariesDir() string
StdOut() io.Writer
StdErr() io.Writer
Logger() *slog.Logger
GetState(ctx context.Context, key string) ([]byte, state.Metadata, error)
SetState(ctx context.Context, key string, value []byte) error
}
type Factory ¶
type Factory interface {
Create() ModuleWithMeta
}
type Initializer ¶
type Initializer interface {
Init(hclCtx *hcl.EvalContext) (Module, error)
}
type JSONStateEncoder ¶
type JSONStateEncoder[T any] struct { Context ExecutionContext }
func NewJSONStateEncoder ¶
func NewJSONStateEncoder[T any](ctx ExecutionContext) *JSONStateEncoder[T]
type Metadata ¶
type Metadata[T Module] struct { Module T `hcl:",remain"` InputMapping map[string]string `hcl:"input_mapping,optional"` Container *ContainerSpec `hcl:"container,block"` Skip *bool `hcl:"skip_when,optional"` Id string `hcl:"id" hcl_write:"-"` ModuleName string `hcl:"name" hcl_write:"-"` OutputDir string `hcl:"out_dir" hcl_write:"-"` Deps []string `hcl:"depends_on,optional"` }
func (*Metadata[T]) ContainerSpec ¶
func (m *Metadata[T]) ContainerSpec() *ContainerSpec
func (*Metadata[T]) Dependencies ¶
func (*Metadata[T]) Execute ¶
func (m *Metadata[T]) Execute(ctx ExecutionContext) error
func (*Metadata[T]) InputMappings ¶
func (*Metadata[T]) ShouldSkip ¶
func (*Metadata[T]) UnmarshalHCL ¶
func (m *Metadata[T]) UnmarshalHCL(body hcl.Body, ctx *hcl.EvalContext) hcl.Diagnostics
func (*Metadata[T]) UnmarshalJSON ¶
func (*Metadata[T]) UnmarshalModuleSpec ¶
func (m *Metadata[T]) UnmarshalModuleSpec(val *commonv1.ModuleSpec) error
type Module ¶
type Module interface {
Execute(ctx ExecutionContext) error
Category() Category
Type() string
}
type ModuleFactoryFunc ¶
type ModuleFactoryFunc func() ModuleWithMeta
func (ModuleFactoryFunc) Create ¶
func (f ModuleFactoryFunc) Create() ModuleWithMeta
type ModuleWithMeta ¶
type ModuleWithMeta interface {
Module
Unwrap() Module
SetModule(m Module)
ID() string
Name() string
SetName(name string)
ShouldSkip() bool
Dependencies() []string
InputMappings() map[string]string
OutDir() string
ContainerSpec() *ContainerSpec
UnmarshalHCL(body hcl.Body, ctx *hcl.EvalContext) hcl.Diagnostics
}
type Registration ¶
type Registration interface {
RegisterAt(registry *TypeRegistry)
}
type RegistrationFunc ¶
type RegistrationFunc func(registry *TypeRegistry)
func (RegistrationFunc) RegisterAt ¶
func (f RegistrationFunc) RegisterAt(registry *TypeRegistry)
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func (*Repository) Builds ¶
func (s *Repository) Builds() map[string]ModuleWithMeta
func (*Repository) Module ¶
func (s *Repository) Module(moduleType Category, moduleName string) ModuleWithMeta
func (*Repository) ModuleByID ¶
func (s *Repository) ModuleByID(id string) ModuleWithMeta
func (*Repository) ModulesByCategory ¶
func (s *Repository) ModulesByCategory(moduleType Category) map[string]ModuleWithMeta
func (*Repository) RegisterModules ¶
func (s *Repository) RegisterModules(modules ...ModuleWithMeta)
func (*Repository) Tasks ¶
func (s *Repository) Tasks() map[string]ModuleWithMeta
func (*Repository) Tools ¶
func (s *Repository) Tools() map[string]ModuleWithMeta
type StateEncoder ¶
type TestExecutionContext ¶
type TestExecutionContext struct {
context.Context
TB testing.TB
StateStore state.Store
TestWorkingDir string
OutputDirectory string
}
func (TestExecutionContext) BinariesDir ¶
func (t TestExecutionContext) BinariesDir() string
func (TestExecutionContext) Logger ¶
func (t TestExecutionContext) Logger() *slog.Logger
func (TestExecutionContext) Name ¶
func (t TestExecutionContext) Name() string
func (TestExecutionContext) OutDir ¶
func (t TestExecutionContext) OutDir() string
func (TestExecutionContext) StdErr ¶
func (t TestExecutionContext) StdErr() io.Writer
func (TestExecutionContext) StdOut ¶
func (t TestExecutionContext) StdOut() io.Writer
func (TestExecutionContext) WorkingDir ¶
func (t TestExecutionContext) WorkingDir() string
type ToolModule ¶
type ToolModule interface {
Module
BinaryNamer
}
type TypeRegistry ¶
type TypeRegistry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry(registrations ...Registration) *TypeRegistry
func (*TypeRegistry) Create ¶
func (r *TypeRegistry) Create(moduleCategory Category, moduleType string) (ModuleWithMeta, error)
func (*TypeRegistry) CreateFromHCL ¶
func (r *TypeRegistry) CreateFromHCL( moduleCategory Category, moduleType string, body hcl.Body, hclCtx *hcl.EvalContext, diagsWriter hcl.DiagnosticWriter, ) (ModuleWithMeta, error)
func (*TypeRegistry) Inventory ¶
func (r *TypeRegistry) Inventory() (inventory map[Category][]string)
func (*TypeRegistry) RegisterModule ¶
func (r *TypeRegistry) RegisterModule(factory Factory)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.