app

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrComponentNotFound          = errors.New("component not found")
	ErrFailedToCreateDaggerClient = errors.New("failed to create Dagger client")
	ErrInvalidConfiguration       = errors.New("invalid configuration")
)

Static errors for err113 compliance.

Functions

func BuildCapabilities

func BuildCapabilities(client *dagger.Client, cfg pipelines.Config) plugins.Capabilities

BuildCapabilities constructs the Layer 1 capability bundle (pkg/shipwright: Builder/Tester/Artifactor/Deployer/Runner) backed by the standalone providers/go implementations (originally Phase 3's go-service decomposition, extracted from internal/capabilities into its own module), wired from the same pipelines.Config the DI container already produces for the legacy --pipeline path. This is what PluginContext.GetCapabilities() (replacing the retired GetPipeline(), WU10 tasks.md 10.1/10.2) exposes to plugins.

Deployer and Runner are always left nil: no concrete implementation exists yet for either (pkg/shipwright.DeployConfig/RunConfig are empty at this change, per design.md D-D) — Capabilities' fields are independently optional by design, so a partial bundle is correct, not a gap. When client is nil (no Dagger connection, e.g. most non-container CLI paths), an empty Capabilities{} is returned rather than constructing implementations against a nil client.

func CheckDaggerEngine

func CheckDaggerEngine(ctx context.Context, client *dagger.Client) error

CheckDaggerEngine verifies that the Dagger engine is accessible and responsive.

func CheckGitRepo

func CheckGitRepo(ctx context.Context, repoURL string) error

CheckGitRepo verifies that a Git repository is accessible. It performs basic validation of the repository URL format.

func CheckRegistry

func CheckRegistry(ctx context.Context, registryURL, user, pass string) error

CheckRegistry verifies that the Docker registry is accessible. It performs a basic connectivity check to the registry URL.

func ConvertConfigToPipelinesConfig

func ConvertConfigToPipelinesConfig(cfg interfaces.Configuration) pipelines.Config

ConvertConfigToPipelinesConfig converts interfaces.Configuration to pipelines.Config. This function is exported to allow external packages to convert configuration.

func GetDaggerClientFromConfig

func GetDaggerClientFromConfig(ctx context.Context, _ interfaces.Configuration) (*dagger.Client, error)

GetDaggerClientFromConfig creates a Dagger client from configuration. This is a helper function for health checks.

func Initialize

func Initialize(ctx context.Context, cfg interfaces.Configuration) error

Initialize sets up the global container instance.

func NewBuildStepHandler

func NewBuildStepHandler(config interfaces.Configuration, client *dagger.Client) interfaces.StepHandler

NewBuildStepHandler creates a new build step handler.

func NewHookManager

func NewHookManager() interfaces.HookManager

NewHookManager creates a new hook manager.

func NewLintStepHandler

func NewLintStepHandler(config interfaces.Configuration, client *dagger.Client) interfaces.StepHandler

NewLintStepHandler creates a new lint step handler.

func NewMockHTTPResponse

func NewMockHTTPResponse(statusCode int, body string) *http.Response

NewMockHTTPResponse builds a minimal *http.Response for MockHTTPClient expectations to return.

func NewPackageStepHandler

func NewPackageStepHandler(cfg interfaces.Configuration, client *dagger.Client) interfaces.StepHandler

func NewPipelineExecutor

func NewPipelineExecutor(stepRegistry interfaces.StepRegistry, hookManager interfaces.HookManager) interfaces.PipelineExecutor

NewPipelineExecutor creates a new pipeline executor.

func NewPushStepHandler

func NewPushStepHandler(cfg interfaces.Configuration, client *dagger.Client) interfaces.StepHandler

func NewReleaseStepHandler

func NewReleaseStepHandler(cfg interfaces.Configuration, client *dagger.Client) interfaces.StepHandler

func NewSecurityStepHandler

func NewSecurityStepHandler(config interfaces.Configuration, client *dagger.Client) interfaces.StepHandler

NewSecurityStepHandler creates a new security step handler.

func NewSetupStepHandler

func NewSetupStepHandler(config interfaces.Configuration, client *dagger.Client) interfaces.StepHandler

NewSetupStepHandler creates a new setup step handler.

func NewStepRegistry

func NewStepRegistry() interfaces.StepRegistry

NewStepRegistry creates a new step registry.

func NewTagStepHandler

func NewTagStepHandler(cfg interfaces.Configuration, client *dagger.Client) interfaces.StepHandler

Placeholder implementations for other step handlers

func NewTestStepHandler

func NewTestStepHandler(config interfaces.Configuration, client *dagger.Client) interfaces.StepHandler

NewTestStepHandler creates a new test step handler.

func Reset

func Reset()

Reset clears the global container (useful for testing).

func RunHealthChecks

func RunHealthChecks(ctx context.Context, cfg interfaces.Configuration) error

RunHealthChecks executes all health checks for the configured services. It checks Dagger engine, registry (if configured), and Git repository (if configured).

Types

type App

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

App represents the main application instance. It manages the application lifecycle and provides access to core functionality.

Features: - Application lifecycle management (start/stop) - Container management - Graceful shutdown - Component health monitoring

Example usage:

container := app.GetContainer()
application := app.NewApp(container)
if err := application.Start(ctx); err != nil {
    log.Fatal(err)
}
defer application.Stop(ctx)

func NewApp

func NewApp(container *Container) *App

NewApp creates a new application instance.

func (*App) CleanupPlugins

func (a *App) CleanupPlugins(ctx context.Context) error

CleanupPlugins cleans up all loaded plugins. Callers invoke it through defer so it also runs on a failed workflow, not only on the success path.

func (*App) GetContainer

func (a *App) GetContainer() *Container

GetContainer returns the application's container.

func (*App) LoadAndInitializePlugins

func (a *App) LoadAndInitializePlugins(
	ctx context.Context,
	providerRegistry *providers.Registry,
	daggerClient *dagger.Client,
) error

LoadAndInitializePlugins loads every compile-time-registered builtin plugin and initializes it against providerRegistry — the SAME *providers.Registry the caller's workflow run resolves each manifest step against. A plugin contributes a Layer 1 capability implementation by registering into that registry during Initialize (plugins.PluginContext.GetProviderRegistry).

daggerClient is passed explicitly rather than resolved from the container because the container's "daggerClient" component connects lazily: the --list-steps path must be able to wire plugins WITHOUT starting a Dagger engine, and passes nil. A nil client yields an empty capability bundle (BuildCapabilities' documented behavior), which is correct — resolution does not need a live client.

SECURITY (design.md D-I): this uses PluginRegistry.LoadBuiltinPlugins, not LoadPluginsFromConfig. Only compile-time builtin factories are loaded, so plugin.Open is unreachable from the CLI's plugin wiring and every provider reaching the registry is still build-time-compiled code.

func (*App) Start

func (a *App) Start(ctx context.Context) error

Start starts the application.

func (*App) Stop

func (a *App) Stop(ctx context.Context) error

Stop stops the application.

type Artifact

type Artifact struct {
	Name        string `json:"name"`
	Path        string `json:"path"`
	Type        string `json:"type"`
	Size        int64  `json:"size"`
	Checksum    string `json:"checksum,omitempty"`
	Description string `json:"description,omitempty"`
}

Artifact represents a file or artifact produced by a step.

type BaseStepHandler

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

BaseStepHandler provides common functionality for all step handlers.

func NewBaseStepHandler

func NewBaseStepHandler(config interfaces.Configuration, client *dagger.Client) *BaseStepHandler

NewBaseStepHandler creates a new base step handler.

func (*BaseStepHandler) CanHandle

func (h *BaseStepHandler) CanHandle(_ string) bool

CanHandle implements the StepHandler interface.

func (*BaseStepHandler) Execute

func (h *BaseStepHandler) Execute(_ context.Context, stepName string, _ interfaces.StepConfig) error

Execute implements the StepHandler interface.

func (*BaseStepHandler) GetStepInfo

func (h *BaseStepHandler) GetStepInfo(stepName string) interfaces.StepConfig

GetStepInfo implements the StepHandler interface.

func (*BaseStepHandler) Validate

func (h *BaseStepHandler) Validate(stepName string, _ interfaces.StepConfig) error

Validate implements the StepHandler interface.

type BuildStepHandler

type BuildStepHandler struct {
	*BaseStepHandler
}

BuildStepHandler handles the build step.

func (*BuildStepHandler) CanHandle

func (h *BuildStepHandler) CanHandle(stepName string) bool

func (*BuildStepHandler) Execute

func (h *BuildStepHandler) Execute(ctx context.Context, _ string, config interfaces.StepConfig) error

func (*BuildStepHandler) GetStepInfo

func (h *BuildStepHandler) GetStepInfo(_ string) interfaces.StepConfig

func (*BuildStepHandler) Validate

func (h *BuildStepHandler) Validate(stepName string, config interfaces.StepConfig) error

type Container

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

Container manages dependency injection for the application.

func GetContainer

func GetContainer() *Container

GetContainer returns the global container instance.

func NewContainer

func NewContainer(ctx context.Context, config interfaces.Configuration) *Container

NewContainer creates a new container instance.

func (*Container) CreateLogger

func (c *Container) CreateLogger() error

CreateLogger initializes go-kit-logger with configuration.

func (*Container) Get

func (c *Container) Get(name string) (any, error)

Get retrieves a component, creating it if necessary.

func (*Container) GetConfiguration

func (c *Container) GetConfiguration() interfaces.Configuration

GetConfiguration returns the configuration instance.

func (*Container) GetDaggerClient

func (c *Container) GetDaggerClient() (*dagger.Client, error)

GetDaggerClient returns the cached Dagger client. Returns the cached Dagger client. Connection management is handled by Dagger internally.

func (*Container) GetLinter

func (c *Container) GetLinter() (interfaces.Linter, error)

GetLinter implements SecurityProvider interface.

func (*Container) GetLogger

func (c *Container) GetLogger() (interfaces.Logger, error)

GetLogger implements LoggingProvider interface. GetLogger is deprecated - use logger.L() directly from go-kit-logger This method is kept for backward compatibility but returns nil

func (*Container) GetRegistryAuth

func (c *Container) GetRegistryAuth() (string, string, error)

GetRegistryAuth implements RegistryProvider interface.

func (*Container) GetRegistryConfig

func (c *Container) GetRegistryConfig() (interfaces.RegistryConfig, error)

GetRegistryConfig implements RegistryProvider interface.

func (*Container) GetVulnChecker

func (c *Container) GetVulnChecker() (interfaces.VulnChecker, error)

GetVulnChecker implements SecurityProvider interface.

func (*Container) Register

func (c *Container) Register(name string, factory func() (any, error))

Register registers a component factory function.

func (*Container) Start

func (c *Container) Start(_ context.Context) error

Start initializes all registered components.

func (*Container) Stop

func (c *Container) Stop(_ context.Context) error

Stop stops the container and cleans up resources.

func (*Container) Validate

func (c *Container) Validate() error

Validate validates the container configuration.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient abstracts *http.Client so health checks can be tested with a mock instead of making real network calls.

type HookExecutor

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

HookExecutor provides a convenient way to execute hooks with error handling.

func NewHookExecutor

func NewHookExecutor(hookManager interfaces.HookManager, logger interfaces.Logger) *HookExecutor

NewHookExecutor creates a new hook executor.

func (*HookExecutor) ExecuteAfterHooks

func (he *HookExecutor) ExecuteAfterHooks(ctx context.Context, stepName string) error

ExecuteAfterHooks executes all after hooks for a step.

func (*HookExecutor) ExecuteBeforeHooks

func (he *HookExecutor) ExecuteBeforeHooks(ctx context.Context, stepName string) error

ExecuteBeforeHooks executes all before hooks for a step.

func (*HookExecutor) ExecuteErrorHooks

func (he *HookExecutor) ExecuteErrorHooks(ctx context.Context, stepName string) error

ExecuteErrorHooks executes all error hooks for a step.

func (*HookExecutor) ExecuteStepWithHooks

func (he *HookExecutor) ExecuteStepWithHooks(ctx context.Context, stepName string, stepFunc func() error) error

ExecuteStepWithHooks executes a step with all appropriate hooks.

func (*HookExecutor) ExecuteSuccessHooks

func (he *HookExecutor) ExecuteSuccessHooks(ctx context.Context, stepName string) error

ExecuteSuccessHooks executes all success hooks for a step.

type HookManager

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

HookManager implements the HookManager interface for managing pipeline hooks.

func (*HookManager) ClearAllHooks

func (hm *HookManager) ClearAllHooks()

ClearAllHooks removes all registered hooks.

func (*HookManager) ClearHooks

func (hm *HookManager) ClearHooks(stepName string)

ClearHooks removes all hooks for a specific step.

func (*HookManager) ExecuteHooks

func (hm *HookManager) ExecuteHooks(ctx context.Context, stepName string, hookType interfaces.HookType) error

ExecuteHooks executes all hooks for a specific step and hook type.

func (*HookManager) GetHooks

func (hm *HookManager) GetHooks(stepName string, hookType interfaces.HookType) []interfaces.HookFunc

GetHooks returns all hooks for a specific step and hook type.

func (*HookManager) ListHooks

func (hm *HookManager) ListHooks() map[string]map[interfaces.HookType]int

ListHooks returns a map of all registered hooks.

func (*HookManager) RegisterHook

func (hm *HookManager) RegisterHook(stepName string, hookType interfaces.HookType, hook interfaces.HookFunc) error

RegisterHook registers a hook for a specific step and hook type.

func (*HookManager) RemoveHook

func (hm *HookManager) RemoveHook(stepName string, hookType interfaces.HookType, hook interfaces.HookFunc) error

RemoveHook removes a specific hook from a step and hook type.

type LintStepHandler

type LintStepHandler struct {
	*BaseStepHandler
}

LintStepHandler handles the lint step.

func (*LintStepHandler) CanHandle

func (h *LintStepHandler) CanHandle(stepName string) bool

func (*LintStepHandler) Execute

func (h *LintStepHandler) Execute(ctx context.Context, _ string, config interfaces.StepConfig) error

func (*LintStepHandler) GetStepInfo

func (h *LintStepHandler) GetStepInfo(_ string) interfaces.StepConfig

func (*LintStepHandler) Validate

func (h *LintStepHandler) Validate(stepName string, config interfaces.StepConfig) error

type Linter

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

Linter implements code linting.

func NewLinter

func NewLinter(config interfaces.Configuration) *Linter

NewLinter creates a new linter.

func (*Linter) GetReport

func (l *Linter) GetReport(_ context.Context) (string, error)

GetReport returns the linting report.

func (*Linter) Lint

func (l *Linter) Lint(_ context.Context, _ *dagger.Directory) error

Lint runs linting on the source code.

type LocalExecutor

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

LocalExecutor executes pipeline steps locally without Docker

func NewLocalExecutor

func NewLocalExecutor(config interfaces.Configuration) *LocalExecutor

NewLocalExecutor creates a new local executor

func (*LocalExecutor) ExecuteStep

func (le *LocalExecutor) ExecuteStep(ctx context.Context, stepName string) error

ExecuteStep executes a pipeline step locally

type Logger

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

Logger implements structured logging.

func NewLogger

func NewLogger(config interfaces.Configuration) *Logger

NewLogger creates a new logger.

func (*Logger) Debug

func (l *Logger) Debug(msg string, fields ...any)

Debug logs a debug message.

func (*Logger) Error

func (l *Logger) Error(msg string, fields ...any)

Error logs an error message.

func (*Logger) Fatal

func (l *Logger) Fatal(msg string, fields ...any)

Fatal logs a fatal message and exits.

func (*Logger) Info

func (l *Logger) Info(msg string, fields ...any)

Info logs an info message.

func (*Logger) Warn

func (l *Logger) Warn(msg string, fields ...any)

Warn logs a warning message.

func (*Logger) WithField

func (l *Logger) WithField(_ string, _ any) interfaces.Logger

WithField adds a field to the logger.

func (*Logger) WithFields

func (l *Logger) WithFields(_ map[string]any) interfaces.Logger

WithFields adds multiple fields to the logger.

type MockConfiguration

type MockConfiguration struct {
	AllFunc              func() map[string]any
	EnvironmentFunc      func() string
	GetBoolFunc          func(key string) bool
	GetConfigSummaryFunc func() string
	GetDurationFunc      func(key string) time.Duration
	GetFloatFunc         func(key string) float64
	GetFunc              func(key string) any
	GetIntFunc           func(key string) int
	GetStringFunc        func(key string) string
	HasFunc              func(key string) bool
	LoadFunc             func() error
	LoadWithDefaultsFunc func(defaults map[string]any) error
	LoggingFunc          func() interfaces.LoggingConfig
	PipelineFunc         func() interfaces.PipelineConfig
	RegistryFunc         func() interfaces.RegistryConfig
	SecurityFunc         func() interfaces.SecurityConfig
	SetFunc              func(key string, value any)
	ValidateFunc         func() error
}

MockConfiguration implements interfaces.Configuration interface for testing.

func NewMockConfiguration

func NewMockConfiguration() *MockConfiguration

NewMockConfiguration creates a new mock configuration.

func (*MockConfiguration) All

func (m *MockConfiguration) All() map[string]any

All implements interfaces.Configuration interface.

func (*MockConfiguration) Environment

func (m *MockConfiguration) Environment() string

Environment implements interfaces.Configuration interface.

func (*MockConfiguration) Get

func (m *MockConfiguration) Get(key string) any

Get implements interfaces.Configuration interface.

func (*MockConfiguration) GetBool

func (m *MockConfiguration) GetBool(key string) bool

GetBool implements interfaces.Configuration interface.

func (*MockConfiguration) GetConfigSummary

func (m *MockConfiguration) GetConfigSummary() string

GetConfigSummary implements interfaces.Configuration interface.

func (*MockConfiguration) GetDuration

func (m *MockConfiguration) GetDuration(key string) time.Duration

GetDuration implements interfaces.Configuration interface.

func (*MockConfiguration) GetFloat

func (m *MockConfiguration) GetFloat(key string) float64

GetFloat implements interfaces.Configuration interface.

func (*MockConfiguration) GetInt

func (m *MockConfiguration) GetInt(key string) int

GetInt implements interfaces.Configuration interface.

func (*MockConfiguration) GetString

func (m *MockConfiguration) GetString(key string) string

GetString implements interfaces.Configuration interface.

func (*MockConfiguration) Has

func (m *MockConfiguration) Has(key string) bool

Has implements interfaces.Configuration interface.

func (*MockConfiguration) Load

func (m *MockConfiguration) Load() error

Load implements interfaces.Configuration interface.

func (*MockConfiguration) LoadWithDefaults

func (m *MockConfiguration) LoadWithDefaults(defaults map[string]any) error

LoadWithDefaults implements interfaces.Configuration interface.

func (*MockConfiguration) Logging

Logging implements interfaces.Configuration interface.

func (*MockConfiguration) Pipeline

Pipeline implements interfaces.Configuration interface.

func (*MockConfiguration) Registry

Registry implements interfaces.Configuration interface.

func (*MockConfiguration) Security

Security implements interfaces.Configuration interface.

func (*MockConfiguration) Set

func (m *MockConfiguration) Set(key string, value any)

Set implements interfaces.Configuration interface.

func (*MockConfiguration) Validate

func (m *MockConfiguration) Validate() error

Validate implements interfaces.Configuration interface.

type MockHTTPClient

type MockHTTPClient struct {
	mock.Mock
}

MockHTTPClient implements HTTPClient using testify's mock package, so health check tests can assert on requests and control responses without making real network calls.

func (*MockHTTPClient) Do

func (m *MockHTTPClient) Do(req *http.Request) (*http.Response, error)

Do implements HTTPClient.

type MockHookManager

type MockHookManager struct {
	ExecuteHooksFunc func(ctx context.Context, stepName string, hookType interfaces.HookType) error
	GetHooksFunc     func(stepName string, hookType interfaces.HookType) []interfaces.HookFunc
	RegisterHookFunc func(stepName string, hookType interfaces.HookType, hook interfaces.HookFunc) error
	RemoveHookFunc   func(stepName string, hookType interfaces.HookType, hook interfaces.HookFunc) error
}

MockHookManager implements interfaces.HookManager interface for testing.

func NewMockHookManager

func NewMockHookManager() *MockHookManager

NewMockHookManager creates a new mock hook manager.

func (*MockHookManager) ExecuteHooks

func (m *MockHookManager) ExecuteHooks(ctx context.Context, stepName string, hookType interfaces.HookType) error

ExecuteHooks implements interfaces.HookManager interface.

func (*MockHookManager) GetHooks

func (m *MockHookManager) GetHooks(stepName string, hookType interfaces.HookType) []interfaces.HookFunc

GetHooks implements interfaces.HookManager interface.

func (*MockHookManager) RegisterHook

func (m *MockHookManager) RegisterHook(stepName string, hookType interfaces.HookType, hook interfaces.HookFunc) error

RegisterHook implements interfaces.HookManager interface.

func (*MockHookManager) RemoveHook

func (m *MockHookManager) RemoveHook(stepName string, hookType interfaces.HookType, hook interfaces.HookFunc) error

RemoveHook implements interfaces.HookManager interface.

type MockLinter

type MockLinter struct {
	LintFunc      func(ctx context.Context, src *dagger.Directory) error
	GetReportFunc func(ctx context.Context) (string, error)
}

MockLinter implements interfaces.Linter interface for testing.

func NewMockLinter

func NewMockLinter() *MockLinter

NewMockLinter creates a new mock linter.

func (*MockLinter) GetReport

func (m *MockLinter) GetReport(ctx context.Context) (string, error)

GetReport implements interfaces.Linter interface.

func (*MockLinter) Lint

func (m *MockLinter) Lint(ctx context.Context, src *dagger.Directory) error

Lint implements interfaces.Linter interface.

type MockLogger

type MockLogger struct {
	DebugFunc      func(msg string, fields ...any)
	ErrorFunc      func(msg string, fields ...any)
	FatalFunc      func(msg string, fields ...any)
	InfoFunc       func(msg string, fields ...any)
	WarnFunc       func(msg string, fields ...any)
	WithFieldFunc  func(key string, value any) interfaces.Logger
	WithFieldsFunc func(fields map[string]any) interfaces.Logger
}

MockLogger implements interfaces.Logger interface for testing.

func NewMockLogger

func NewMockLogger() *MockLogger

NewMockLogger creates a new mock logger.

func (*MockLogger) Debug

func (m *MockLogger) Debug(msg string, fields ...any)

Debug implements interfaces.Logger interface.

func (*MockLogger) Error

func (m *MockLogger) Error(msg string, fields ...any)

Error implements interfaces.Logger interface.

func (*MockLogger) Fatal

func (m *MockLogger) Fatal(msg string, fields ...any)

Fatal implements interfaces.Logger interface.

func (*MockLogger) Info

func (m *MockLogger) Info(msg string, fields ...any)

Info implements interfaces.Logger interface.

func (*MockLogger) Warn

func (m *MockLogger) Warn(msg string, fields ...any)

Warn implements interfaces.Logger interface.

func (*MockLogger) WithField

func (m *MockLogger) WithField(key string, value any) interfaces.Logger

WithField implements interfaces.Logger interface.

func (*MockLogger) WithFields

func (m *MockLogger) WithFields(fields map[string]any) interfaces.Logger

WithFields implements interfaces.Logger interface.

type MockStepHandler

type MockStepHandler struct {
	CanHandleFunc   func(stepName string) bool
	ExecuteFunc     func(ctx context.Context, stepName string, config interfaces.StepConfig) error
	GetStepInfoFunc func(stepName string) interfaces.StepConfig
	ValidateFunc    func(stepName string, config interfaces.StepConfig) error
}

MockStepHandler implements interfaces.StepHandler interface for testing.

func NewMockStepHandler

func NewMockStepHandler() *MockStepHandler

NewMockStepHandler creates a new mock step handler.

func (*MockStepHandler) CanHandle

func (m *MockStepHandler) CanHandle(stepName string) bool

CanHandle implements interfaces.StepHandler interface.

func (*MockStepHandler) Execute

func (m *MockStepHandler) Execute(ctx context.Context, stepName string, config interfaces.StepConfig) error

Execute implements interfaces.StepHandler interface.

func (*MockStepHandler) GetStepInfo

func (m *MockStepHandler) GetStepInfo(stepName string) interfaces.StepConfig

GetStepInfo implements interfaces.StepHandler interface.

func (*MockStepHandler) Validate

func (m *MockStepHandler) Validate(stepName string, config interfaces.StepConfig) error

Validate implements interfaces.StepHandler interface.

type MockStepRegistry

type MockStepRegistry struct {
	ExecuteStepFunc       func(ctx context.Context, stepName string) error
	GetExecutionOrderFunc func() ([]string, error)
	GetStepConfigFunc     func(stepName string) (interfaces.StepConfig, error)
	GetStepHandlerFunc    func(stepName string) (interfaces.StepHandler, error)
	ListStepsFunc         func() []string
	RegisterStepFunc      func(stepName string, handler interfaces.StepHandler) error
	ValidateStepFunc      func(stepName string) error
}

MockStepRegistry implements interfaces.StepRegistry interface for testing.

func NewMockStepRegistry

func NewMockStepRegistry() *MockStepRegistry

NewMockStepRegistry creates a new mock step registry.

func (*MockStepRegistry) ExecuteStep

func (m *MockStepRegistry) ExecuteStep(ctx context.Context, stepName string) error

ExecuteStep implements interfaces.StepRegistry interface.

func (*MockStepRegistry) GetExecutionOrder

func (m *MockStepRegistry) GetExecutionOrder() ([]string, error)

GetExecutionOrder implements interfaces.StepRegistry interface.

func (*MockStepRegistry) GetStepConfig

func (m *MockStepRegistry) GetStepConfig(stepName string) (interfaces.StepConfig, error)

GetStepConfig implements interfaces.StepRegistry interface.

func (*MockStepRegistry) GetStepHandler

func (m *MockStepRegistry) GetStepHandler(stepName string) (interfaces.StepHandler, error)

GetStepHandler implements interfaces.StepRegistry interface.

func (*MockStepRegistry) ListSteps

func (m *MockStepRegistry) ListSteps() []string

ListSteps implements interfaces.StepRegistry interface.

func (*MockStepRegistry) RegisterStep

func (m *MockStepRegistry) RegisterStep(stepName string, handler interfaces.StepHandler) error

RegisterStep implements interfaces.StepRegistry interface.

func (*MockStepRegistry) ValidateStep

func (m *MockStepRegistry) ValidateStep(stepName string) error

ValidateStep implements interfaces.StepRegistry interface.

type MockVulnChecker

type MockVulnChecker struct {
	CheckFunc     func(ctx context.Context, src *dagger.Directory) error
	GetReportFunc func(ctx context.Context) (string, error)
}

MockVulnChecker implements interfaces.VulnChecker interface for testing.

func NewMockVulnChecker

func NewMockVulnChecker() *MockVulnChecker

NewMockVulnChecker creates a new mock vulnerability checker.

func (*MockVulnChecker) Check

func (m *MockVulnChecker) Check(ctx context.Context, src *dagger.Directory) error

Check implements interfaces.VulnChecker interface.

func (*MockVulnChecker) GetReport

func (m *MockVulnChecker) GetReport(ctx context.Context) (string, error)

GetReport implements interfaces.VulnChecker interface.

type PipelineExecutor

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

PipelineExecutor implements the PipelineExecutor interface for executing pipelines.

func (*PipelineExecutor) CancelPipeline

func (pe *PipelineExecutor) CancelPipeline(pipelineName string) error

CancelPipeline cancels a running pipeline.

func (*PipelineExecutor) ClearAllPipelineStatus

func (pe *PipelineExecutor) ClearAllPipelineStatus()

ClearAllPipelineStatus removes all pipeline statuses.

func (*PipelineExecutor) ClearPipelineStatus

func (pe *PipelineExecutor) ClearPipelineStatus(pipelineName string)

ClearPipelineStatus removes the status for a specific pipeline.

func (*PipelineExecutor) ExecutePipeline

func (pe *PipelineExecutor) ExecutePipeline(ctx context.Context, pipelineName string, steps []string) error

ExecutePipeline executes a complete pipeline with the specified steps.

func (*PipelineExecutor) ExecuteStep

func (pe *PipelineExecutor) ExecuteStep(ctx context.Context, pipelineName string, stepName string) error

ExecuteStep executes a single step in a pipeline.

func (*PipelineExecutor) GetPipelineLogs

func (pe *PipelineExecutor) GetPipelineLogs(pipelineName string) ([]string, error)

GetPipelineLogs returns the logs for a pipeline.

func (*PipelineExecutor) GetPipelineStatus

func (pe *PipelineExecutor) GetPipelineStatus(pipelineName string) (interfaces.PipelineStatus, error)

GetPipelineStatus returns the current status of a pipeline.

func (*PipelineExecutor) GetStepStatus

func (pe *PipelineExecutor) GetStepStatus(pipelineName string, stepName string) (interfaces.StepResult, error)

GetStepStatus returns the status of a specific step in a pipeline.

func (*PipelineExecutor) ListPipelines

func (pe *PipelineExecutor) ListPipelines() []string

ListPipelines returns a list of all pipeline names.

type PipelineStatus

type PipelineStatus struct {
	PipelineName string                `json:"pipelineName"`
	Status       string                `json:"status"` // running, completed, failed, cancelled
	StartTime    time.Time             `json:"startTime"`
	EndTime      *time.Time            `json:"endTime,omitempty"`
	Duration     time.Duration         `json:"duration"`
	Steps        map[string]StepResult `json:"steps"`
	Metadata     map[string]any        `json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

PipelineStatus represents the current status of a pipeline execution.

type SecurityStepHandler

type SecurityStepHandler struct {
	*BaseStepHandler
}

SecurityStepHandler handles the security step.

func (*SecurityStepHandler) CanHandle

func (h *SecurityStepHandler) CanHandle(stepName string) bool

func (*SecurityStepHandler) Execute

func (*SecurityStepHandler) GetStepInfo

func (h *SecurityStepHandler) GetStepInfo(_ string) interfaces.StepConfig

func (*SecurityStepHandler) Validate

func (h *SecurityStepHandler) Validate(stepName string, config interfaces.StepConfig) error

type SetupStepHandler

type SetupStepHandler struct {
	*BaseStepHandler
}

SetupStepHandler handles the setup step.

func (*SetupStepHandler) CanHandle

func (h *SetupStepHandler) CanHandle(stepName string) bool

func (*SetupStepHandler) Execute

func (h *SetupStepHandler) Execute(ctx context.Context, stepName string, config interfaces.StepConfig) error

func (*SetupStepHandler) GetStepInfo

func (h *SetupStepHandler) GetStepInfo(_ string) interfaces.StepConfig

func (*SetupStepHandler) Validate

func (h *SetupStepHandler) Validate(stepName string, config interfaces.StepConfig) error

type StepRegistry

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

StepRegistry implements the StepRegistry interface for managing pipeline steps.

func (*StepRegistry) ClearAllSteps

func (sr *StepRegistry) ClearAllSteps()

ClearAllSteps removes all registered steps.

func (*StepRegistry) ExecuteStep

func (sr *StepRegistry) ExecuteStep(ctx context.Context, stepName string) error

ExecuteStep executes a specific step with its handler.

func (*StepRegistry) GetExecutionOrder

func (sr *StepRegistry) GetExecutionOrder() ([]string, error)

GetExecutionOrder returns the steps in dependency order.

func (*StepRegistry) GetOptionalSteps

func (sr *StepRegistry) GetOptionalSteps() []string

GetOptionalSteps returns a list of all optional steps.

func (*StepRegistry) GetParallelSteps

func (sr *StepRegistry) GetParallelSteps() []string

GetParallelSteps returns a list of all steps that can run in parallel.

func (*StepRegistry) GetRequiredSteps

func (sr *StepRegistry) GetRequiredSteps() []string

GetRequiredSteps returns a list of all required steps.

func (*StepRegistry) GetStepConfig

func (sr *StepRegistry) GetStepConfig(stepName string) (interfaces.StepConfig, error)

GetStepConfig returns the configuration for a specific step.

func (*StepRegistry) GetStepCount

func (sr *StepRegistry) GetStepCount() int

GetStepCount returns the number of registered steps.

func (*StepRegistry) GetStepHandler

func (sr *StepRegistry) GetStepHandler(stepName string) (interfaces.StepHandler, error)

GetStepHandler returns the handler for a specific step.

func (*StepRegistry) GetStepInfo

func (sr *StepRegistry) GetStepInfo(stepName string) (map[string]any, error)

GetStepInfo returns detailed information about a step.

func (*StepRegistry) ListSteps

func (sr *StepRegistry) ListSteps() []string

ListSteps returns a list of all registered step names.

func (*StepRegistry) RegisterStep

func (sr *StepRegistry) RegisterStep(stepName string, handler interfaces.StepHandler) error

RegisterStep registers a new step handler.

func (*StepRegistry) UnregisterStep

func (sr *StepRegistry) UnregisterStep(stepName string) error

UnregisterStep removes a step from the registry.

func (*StepRegistry) ValidateDependencies

func (sr *StepRegistry) ValidateDependencies() error

ValidateDependencies validates that all step dependencies are satisfied.

func (*StepRegistry) ValidateStep

func (sr *StepRegistry) ValidateStep(stepName string) error

ValidateStep validates a step configuration.

type StepResult

type StepResult struct {
	StepName  string         `json:"stepName"`
	Success   bool           `json:"success"`
	Duration  time.Duration  `json:"duration"`
	Error     error          `json:"error,omitempty"`
	Output    string         `json:"output,omitempty"`
	Metadata  map[string]any `json:"metadata,omitempty"`
	Artifacts []Artifact     `json:"artifacts,omitempty"`
}

StepResult contains the result of a step execution.

type TestStepHandler

type TestStepHandler struct {
	*BaseStepHandler
}

TestStepHandler handles the test step.

func (*TestStepHandler) CanHandle

func (h *TestStepHandler) CanHandle(stepName string) bool

func (*TestStepHandler) Execute

func (h *TestStepHandler) Execute(ctx context.Context, _ string, config interfaces.StepConfig) error

func (*TestStepHandler) GetStepInfo

func (h *TestStepHandler) GetStepInfo(_ string) interfaces.StepConfig

func (*TestStepHandler) Validate

func (h *TestStepHandler) Validate(stepName string, config interfaces.StepConfig) error

type VulnChecker

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

VulnChecker implements vulnerability checking.

func NewVulnChecker

func NewVulnChecker(config interfaces.Configuration) *VulnChecker

NewVulnChecker creates a new vulnerability checker.

func (*VulnChecker) Check

func (v *VulnChecker) Check(_ context.Context, _ *dagger.Directory) error

Check runs vulnerability checks on the source code.

func (*VulnChecker) GetReport

func (v *VulnChecker) GetReport(_ context.Context) (string, error)

GetReport returns the vulnerability report.

Jump to

Keyboard shortcuts

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