Documentation
¶
Overview ¶
Package executor provides strategy-specific build execution.
Index ¶
- Variables
- func BuildConfigFromDetection(detection *models.DetectionResult) *models.BuildConfig
- func IsNixpacksAvailable() bool
- func MergeConfigs(userConfig, detectedConfig *models.BuildConfig, logger *slog.Logger) *models.BuildConfig
- func ValidateCargoTomlExists(repoPath string) error
- func ValidateDockerfileExists(repoPath string) error
- func ValidateFlakeExists(repoPath string) error
- func ValidateGoModExists(repoPath string) error
- func ValidatePackageJSONExists(repoPath string) error
- func ValidatePythonProjectExists(repoPath string) error
- type AutoDatabaseStrategyExecutor
- func (e *AutoDatabaseStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
- func (e *AutoDatabaseStrategyExecutor) ExecuteWithLogs(ctx context.Context, job *models.BuildJob, externalCallback LogCallback) (*BuildResult, error)
- func (e *AutoDatabaseStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, ...) (string, error)
- func (e *AutoDatabaseStrategyExecutor) Supports(strategy models.BuildStrategy) bool
- type AutoGoStrategyExecutor
- func (e *AutoGoStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
- func (e *AutoGoStrategyExecutor) ExecuteWithLogs(ctx context.Context, job *models.BuildJob, externalCallback LogCallback) (*BuildResult, error)
- func (e *AutoGoStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, ...) (string, error)
- func (e *AutoGoStrategyExecutor) GenerateFlakeWithContext(ctx context.Context, detection *models.DetectionResult, ...) (string, error)
- func (e *AutoGoStrategyExecutor) PreBuild(ctx context.Context, job *models.BuildJob) (*PreBuildResult, error)
- func (e *AutoGoStrategyExecutor) SetDetectionCache(cache cache.DetectionCache)
- func (e *AutoGoStrategyExecutor) Supports(strategy models.BuildStrategy) bool
- type AutoNodeStrategyExecutor
- func (e *AutoNodeStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
- func (e *AutoNodeStrategyExecutor) ExecuteWithLogs(ctx context.Context, job *models.BuildJob, externalCallback LogCallback) (*BuildResult, error)
- func (e *AutoNodeStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, ...) (string, error)
- func (e *AutoNodeStrategyExecutor) Supports(strategy models.BuildStrategy) bool
- type AutoPythonStrategyExecutor
- func (e *AutoPythonStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
- func (e *AutoPythonStrategyExecutor) ExecuteWithLogs(ctx context.Context, job *models.BuildJob, externalCallback LogCallback) (*BuildResult, error)
- func (e *AutoPythonStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, ...) (string, error)
- func (e *AutoPythonStrategyExecutor) Supports(strategy models.BuildStrategy) bool
- type AutoRustStrategyExecutor
- func (e *AutoRustStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
- func (e *AutoRustStrategyExecutor) ExecuteWithLogs(ctx context.Context, job *models.BuildJob, externalCallback LogCallback) (*BuildResult, error)
- func (e *AutoRustStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, ...) (string, error)
- func (e *AutoRustStrategyExecutor) Supports(strategy models.BuildStrategy) bool
- type BuildResult
- type DockerfileStrategyExecutor
- func (e *DockerfileStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
- func (e *DockerfileStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, ...) (string, error)
- func (e *DockerfileStrategyExecutor) Supports(strategy models.BuildStrategy) bool
- type ExecutorRegistry
- func (r *ExecutorRegistry) GetExecutor(strategy models.BuildStrategy) (StrategyExecutor, error)
- func (r *ExecutorRegistry) GetRegisteredStrategies() []models.BuildStrategy
- func (r *ExecutorRegistry) Register(executor StrategyExecutor)
- func (r *ExecutorRegistry) VerifyAllStrategyMappings() map[models.BuildStrategy]error
- func (r *ExecutorRegistry) VerifyRequiredExecutors() error
- func (r *ExecutorRegistry) VerifyStrategyExecutorMapping(strategy models.BuildStrategy) error
- type FlakeStrategyExecutor
- func (e *FlakeStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
- func (e *FlakeStrategyExecutor) ExecuteWithLogs(ctx context.Context, job *models.BuildJob, externalCallback LogCallback) (*BuildResult, error)
- func (e *FlakeStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, ...) (string, error)
- func (e *FlakeStrategyExecutor) Supports(strategy models.BuildStrategy) bool
- type LogCallback
- type NixBuildResult
- type NixBuilder
- type NixpacksStrategyExecutor
- func (e *NixpacksStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
- func (e *NixpacksStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, ...) (string, error)
- func (e *NixpacksStrategyExecutor) Supports(strategy models.BuildStrategy) bool
- type OCIBuildResult
- type OCIBuilder
- type PreBuildResult
- type StrategyExecutor
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoExecutorFound is returned when no executor supports the given strategy. ErrNoExecutorFound = errors.New("no executor found for strategy") // ErrMissingRequiredExecutors is returned when required strategy executors are not registered. ErrMissingRequiredExecutors = errors.New("missing required executors") // ErrFlakeNotFound is returned when a flake.nix is required but not found. ErrFlakeNotFound = errors.New("flake.nix not found in repository") // ErrDockerfileNotFound is returned when a Dockerfile is required but not found. ErrDockerfileNotFound = errors.New("Dockerfile not found in repository") // ErrBuildFailed is returned when the build process fails. ErrBuildFailed = errors.New("build failed") // ErrDetectionFailed is returned when language/framework detection fails. ErrDetectionFailed = errors.New("detection failed") // ErrTemplateRenderFailed is returned when template rendering fails. ErrTemplateRenderFailed = errors.New("template rendering failed") // ErrHashCalculationFailed is returned when vendor hash calculation fails. ErrHashCalculationFailed = errors.New("hash calculation failed") // ErrNixpacksFailed is returned when Nixpacks build fails. ErrNixpacksFailed = errors.New("nixpacks build failed") // ErrUnsupportedStrategy is returned when a strategy is not supported. ErrUnsupportedStrategy = errors.New("unsupported build strategy") )
Executor errors.
var RequiredStrategies = []models.BuildStrategy{ models.BuildStrategyFlake, models.BuildStrategyAutoGo, models.BuildStrategyAutoNode, models.BuildStrategyAutoRust, models.BuildStrategyAutoPython, }
RequiredStrategies lists strategies that MUST have executors registered. These are the core strategies that the build system must support. **Validates: Requirements 2.1**
Functions ¶
func BuildConfigFromDetection ¶
func BuildConfigFromDetection(detection *models.DetectionResult) *models.BuildConfig
BuildConfigFromDetection creates a BuildConfig from a DetectionResult's SuggestedConfig. This is used to convert detection results into a format that can be merged with user config. **Validates: Requirements 3.2**
func IsNixpacksAvailable ¶
func IsNixpacksAvailable() bool
IsNixpacksAvailable checks if nixpacks is installed and available.
func MergeConfigs ¶
func MergeConfigs(userConfig, detectedConfig *models.BuildConfig, logger *slog.Logger) *models.BuildConfig
MergeConfigs merges user-provided config with detected config. User config takes precedence on conflicts. **Validates: Requirements 3.1, 3.2, 3.3**
func ValidateCargoTomlExists ¶
ValidateCargoTomlExists checks if a Cargo.toml exists in the given repository path.
func ValidateDockerfileExists ¶
ValidateDockerfileExists checks if a Dockerfile exists in the given repository path.
func ValidateFlakeExists ¶
ValidateFlakeExists checks if a flake.nix exists in the given repository path.
func ValidateGoModExists ¶
ValidateGoModExists checks if a go.mod exists in the given repository path.
func ValidatePackageJSONExists ¶
ValidatePackageJSONExists checks if a package.json exists in the given repository path.
func ValidatePythonProjectExists ¶
ValidatePythonProjectExists checks if Python project files exist in the given repository path.
Types ¶
type AutoDatabaseStrategyExecutor ¶
type AutoDatabaseStrategyExecutor struct {
// contains filtered or unexported fields
}
AutoDatabaseStrategyExecutor executes builds for database services by generating a flake.nix.
func NewAutoDatabaseStrategyExecutor ¶
func NewAutoDatabaseStrategyExecutor( det detector.Detector, tmplEngine templates.TemplateEngine, nixBuilder NixBuilder, ociBuilder OCIBuilder, logger *slog.Logger, ) *AutoDatabaseStrategyExecutor
NewAutoDatabaseStrategyExecutor creates a new AutoDatabaseStrategyExecutor.
func (*AutoDatabaseStrategyExecutor) Execute ¶
func (e *AutoDatabaseStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
Execute runs the build for a database service.
func (*AutoDatabaseStrategyExecutor) ExecuteWithLogs ¶
func (e *AutoDatabaseStrategyExecutor) ExecuteWithLogs(ctx context.Context, job *models.BuildJob, externalCallback LogCallback) (*BuildResult, error)
ExecuteWithLogs runs the build for a database service with real-time log streaming.
func (*AutoDatabaseStrategyExecutor) GenerateFlake ¶
func (e *AutoDatabaseStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, config models.BuildConfig) (string, error)
GenerateFlake generates a flake.nix for a database service.
func (*AutoDatabaseStrategyExecutor) Supports ¶
func (e *AutoDatabaseStrategyExecutor) Supports(strategy models.BuildStrategy) bool
Supports returns true if this executor handles the given strategy.
type AutoGoStrategyExecutor ¶
type AutoGoStrategyExecutor struct {
// contains filtered or unexported fields
}
AutoGoStrategyExecutor executes builds for Go applications by generating a flake.nix.
func NewAutoGoStrategyExecutor ¶
func NewAutoGoStrategyExecutor( det detector.Detector, tmplEngine templates.TemplateEngine, hashCalc hash.HashCalculator, nixBuilder NixBuilder, ociBuilder OCIBuilder, logger *slog.Logger, ) *AutoGoStrategyExecutor
NewAutoGoStrategyExecutor creates a new AutoGoStrategyExecutor.
func NewAutoGoStrategyExecutorWithCache ¶
func NewAutoGoStrategyExecutorWithCache( det detector.Detector, tmplEngine templates.TemplateEngine, hashCalc hash.HashCalculator, nixBuilder NixBuilder, ociBuilder OCIBuilder, logger *slog.Logger, detectionCache cache.DetectionCache, ) *AutoGoStrategyExecutor
NewAutoGoStrategyExecutorWithCache creates a new AutoGoStrategyExecutor with detection caching. **Validates: Requirements 4.3**
func (*AutoGoStrategyExecutor) Execute ¶
func (e *AutoGoStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
Execute runs the build for a Go application (without external log streaming).
func (*AutoGoStrategyExecutor) ExecuteWithLogs ¶
func (e *AutoGoStrategyExecutor) ExecuteWithLogs(ctx context.Context, job *models.BuildJob, externalCallback LogCallback) (*BuildResult, error)
ExecuteWithLogs runs the build for a Go application with real-time log streaming. **Validates: Requirements 1.1, 1.2, 4.2**
func (*AutoGoStrategyExecutor) GenerateFlake ¶
func (e *AutoGoStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, config models.BuildConfig) (string, error)
GenerateFlake generates a flake.nix for a Go application. **Validates: Requirements 16.2** - Sets CGO_ENABLED based on detection result
func (*AutoGoStrategyExecutor) GenerateFlakeWithContext ¶
func (e *AutoGoStrategyExecutor) GenerateFlakeWithContext(ctx context.Context, detection *models.DetectionResult, config models.BuildConfig, buildCtx validation.LdflagsBuildContext) (string, error)
GenerateFlakeWithContext generates a flake.nix for a Go application with build context for ldflags substitution. **Validates: Requirements 16.2** - Sets CGO_ENABLED based on detection result **Validates: Requirements 18.3** - Performs ldflags variable substitution
func (*AutoGoStrategyExecutor) PreBuild ¶
func (e *AutoGoStrategyExecutor) PreBuild(ctx context.Context, job *models.BuildJob) (*PreBuildResult, error)
PreBuild performs the pre-build phase: clone and detect. It returns the cloned repo path and detection results. **Validates: Requirements 1.1, 1.2, 4.3**
func (*AutoGoStrategyExecutor) SetDetectionCache ¶
func (e *AutoGoStrategyExecutor) SetDetectionCache(cache cache.DetectionCache)
SetDetectionCache sets the detection cache for the executor. **Validates: Requirements 4.3**
func (*AutoGoStrategyExecutor) Supports ¶
func (e *AutoGoStrategyExecutor) Supports(strategy models.BuildStrategy) bool
Supports returns true if this executor handles the given strategy.
type AutoNodeStrategyExecutor ¶
type AutoNodeStrategyExecutor struct {
// contains filtered or unexported fields
}
AutoNodeStrategyExecutor executes builds for Node.js applications by generating a flake.nix.
func NewAutoNodeStrategyExecutor ¶
func NewAutoNodeStrategyExecutor( det detector.Detector, tmplEngine templates.TemplateEngine, hashCalc hash.HashCalculator, nixBuilder NixBuilder, ociBuilder OCIBuilder, logger *slog.Logger, ) *AutoNodeStrategyExecutor
NewAutoNodeStrategyExecutor creates a new AutoNodeStrategyExecutor.
func (*AutoNodeStrategyExecutor) Execute ¶
func (e *AutoNodeStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
Execute runs the build for a Node.js application (without external log streaming).
func (*AutoNodeStrategyExecutor) ExecuteWithLogs ¶
func (e *AutoNodeStrategyExecutor) ExecuteWithLogs(ctx context.Context, job *models.BuildJob, externalCallback LogCallback) (*BuildResult, error)
ExecuteWithLogs runs the build for a Node.js application with real-time log streaming.
func (*AutoNodeStrategyExecutor) GenerateFlake ¶
func (e *AutoNodeStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, config models.BuildConfig) (string, error)
GenerateFlake generates a flake.nix for a Node.js application.
func (*AutoNodeStrategyExecutor) Supports ¶
func (e *AutoNodeStrategyExecutor) Supports(strategy models.BuildStrategy) bool
Supports returns true if this executor handles the given strategy.
type AutoPythonStrategyExecutor ¶
type AutoPythonStrategyExecutor struct {
// contains filtered or unexported fields
}
AutoPythonStrategyExecutor executes builds for Python applications by generating a flake.nix.
func NewAutoPythonStrategyExecutor ¶
func NewAutoPythonStrategyExecutor( det detector.Detector, tmplEngine templates.TemplateEngine, nixBuilder NixBuilder, ociBuilder OCIBuilder, logger *slog.Logger, ) *AutoPythonStrategyExecutor
NewAutoPythonStrategyExecutor creates a new AutoPythonStrategyExecutor.
func (*AutoPythonStrategyExecutor) Execute ¶
func (e *AutoPythonStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
Execute runs the build for a Python application (without external log streaming).
func (*AutoPythonStrategyExecutor) ExecuteWithLogs ¶
func (e *AutoPythonStrategyExecutor) ExecuteWithLogs(ctx context.Context, job *models.BuildJob, externalCallback LogCallback) (*BuildResult, error)
ExecuteWithLogs runs the build for a Python application with real-time log streaming.
func (*AutoPythonStrategyExecutor) GenerateFlake ¶
func (e *AutoPythonStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, config models.BuildConfig) (string, error)
GenerateFlake generates a flake.nix for a Python application.
func (*AutoPythonStrategyExecutor) Supports ¶
func (e *AutoPythonStrategyExecutor) Supports(strategy models.BuildStrategy) bool
Supports returns true if this executor handles the given strategy.
type AutoRustStrategyExecutor ¶
type AutoRustStrategyExecutor struct {
// contains filtered or unexported fields
}
AutoRustStrategyExecutor executes builds for Rust applications by generating a flake.nix.
func NewAutoRustStrategyExecutor ¶
func NewAutoRustStrategyExecutor( det detector.Detector, tmplEngine templates.TemplateEngine, hashCalc hash.HashCalculator, nixBuilder NixBuilder, ociBuilder OCIBuilder, logger *slog.Logger, ) *AutoRustStrategyExecutor
NewAutoRustStrategyExecutor creates a new AutoRustStrategyExecutor.
func (*AutoRustStrategyExecutor) Execute ¶
func (e *AutoRustStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
Execute runs the build for a Rust application (without external log streaming).
func (*AutoRustStrategyExecutor) ExecuteWithLogs ¶
func (e *AutoRustStrategyExecutor) ExecuteWithLogs(ctx context.Context, job *models.BuildJob, externalCallback LogCallback) (*BuildResult, error)
ExecuteWithLogs runs the build for a Rust application with real-time log streaming.
func (*AutoRustStrategyExecutor) GenerateFlake ¶
func (e *AutoRustStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, config models.BuildConfig) (string, error)
GenerateFlake generates a flake.nix for a Rust application using crane.
func (*AutoRustStrategyExecutor) Supports ¶
func (e *AutoRustStrategyExecutor) Supports(strategy models.BuildStrategy) bool
Supports returns true if this executor handles the given strategy.
type BuildResult ¶
type BuildResult struct {
Artifact string `json:"artifact"`
StorePath string `json:"store_path,omitempty"` // For pure-nix
ImageTag string `json:"image_tag,omitempty"` // For OCI
Logs string `json:"logs"`
}
BuildResult represents the output of a completed build.
type DockerfileStrategyExecutor ¶
type DockerfileStrategyExecutor struct {
// contains filtered or unexported fields
}
DockerfileStrategyExecutor executes builds using an existing Dockerfile. This strategy always produces OCI images.
func NewDockerfileStrategyExecutor ¶
func NewDockerfileStrategyExecutor( tmplEngine templates.TemplateEngine, ociBuilder OCIBuilder, logger *slog.Logger, ) *DockerfileStrategyExecutor
NewDockerfileStrategyExecutor creates a new DockerfileStrategyExecutor.
func (*DockerfileStrategyExecutor) Execute ¶
func (e *DockerfileStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
Execute runs the build using the Dockerfile. Dockerfile strategy always produces OCI images.
func (*DockerfileStrategyExecutor) GenerateFlake ¶
func (e *DockerfileStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, config models.BuildConfig) (string, error)
GenerateFlake generates a flake.nix wrapper for Dockerfile builds. This uses nix2container to build OCI images from the Dockerfile.
func (*DockerfileStrategyExecutor) Supports ¶
func (e *DockerfileStrategyExecutor) Supports(strategy models.BuildStrategy) bool
Supports returns true if this executor handles the given strategy.
type ExecutorRegistry ¶
type ExecutorRegistry struct {
// contains filtered or unexported fields
}
ExecutorRegistry manages multiple strategy executors.
func NewExecutorRegistry ¶
func NewExecutorRegistry() *ExecutorRegistry
NewExecutorRegistry creates a new ExecutorRegistry.
func (*ExecutorRegistry) GetExecutor ¶
func (r *ExecutorRegistry) GetExecutor(strategy models.BuildStrategy) (StrategyExecutor, error)
GetExecutor returns the executor that supports the given strategy.
func (*ExecutorRegistry) GetRegisteredStrategies ¶
func (r *ExecutorRegistry) GetRegisteredStrategies() []models.BuildStrategy
GetRegisteredStrategies returns a list of all strategies that have registered executors.
func (*ExecutorRegistry) Register ¶
func (r *ExecutorRegistry) Register(executor StrategyExecutor)
Register adds an executor to the registry.
func (*ExecutorRegistry) VerifyAllStrategyMappings ¶
func (r *ExecutorRegistry) VerifyAllStrategyMappings() map[models.BuildStrategy]error
VerifyAllStrategyMappings verifies that all valid strategies have correct executor mappings. Returns a map of strategy to error for any strategies that fail verification. **Validates: Requirements 5.1, 6.1, 7.1, 8.1, 9.1, 10.1, 11.1**
func (*ExecutorRegistry) VerifyRequiredExecutors ¶
func (r *ExecutorRegistry) VerifyRequiredExecutors() error
VerifyRequiredExecutors checks that all required strategies have registered executors. Returns an error listing any missing executors. **Validates: Requirements 2.1, 2.2**
func (*ExecutorRegistry) VerifyStrategyExecutorMapping ¶
func (r *ExecutorRegistry) VerifyStrategyExecutorMapping(strategy models.BuildStrategy) error
VerifyStrategyExecutorMapping verifies that GetExecutor returns the correct executor type for each strategy. It checks that the returned executor actually supports the requested strategy. **Validates: Requirements 5.1, 6.1, 7.1, 8.1, 9.1, 10.1, 11.1**
type FlakeStrategyExecutor ¶
type FlakeStrategyExecutor struct {
// contains filtered or unexported fields
}
FlakeStrategyExecutor executes builds using an existing flake.nix from the repository.
func NewFlakeStrategyExecutor ¶
func NewFlakeStrategyExecutor(nixBuilder NixBuilder, ociBuilder OCIBuilder, logger *slog.Logger) *FlakeStrategyExecutor
NewFlakeStrategyExecutor creates a new FlakeStrategyExecutor.
func (*FlakeStrategyExecutor) Execute ¶
func (e *FlakeStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
Execute runs the build using the existing flake.nix from the repository (without external log streaming).
func (*FlakeStrategyExecutor) ExecuteWithLogs ¶
func (e *FlakeStrategyExecutor) ExecuteWithLogs(ctx context.Context, job *models.BuildJob, externalCallback LogCallback) (*BuildResult, error)
ExecuteWithLogs runs the build using the existing flake.nix with real-time log streaming.
func (*FlakeStrategyExecutor) GenerateFlake ¶
func (e *FlakeStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, config models.BuildConfig) (string, error)
GenerateFlake returns empty string as this strategy uses existing flake.nix.
func (*FlakeStrategyExecutor) Supports ¶
func (e *FlakeStrategyExecutor) Supports(strategy models.BuildStrategy) bool
Supports returns true if this executor handles the given strategy.
type LogCallback ¶
type LogCallback func(line string)
LogCallback is a function that receives log lines during build execution.
type NixBuildResult ¶
NixBuildResult holds the result of a Nix build.
type NixBuilder ¶
type NixBuilder interface {
BuildWithLogCallback(ctx context.Context, job *models.BuildJob, callback func(line string)) (*NixBuildResult, error)
}
NixBuilder interface for building pure-nix artifacts.
type NixpacksStrategyExecutor ¶
type NixpacksStrategyExecutor struct {
// contains filtered or unexported fields
}
NixpacksStrategyExecutor executes builds using Nixpacks. This strategy always produces OCI images.
func NewNixpacksStrategyExecutor ¶
func NewNixpacksStrategyExecutor( ociBuilder OCIBuilder, logger *slog.Logger, ) *NixpacksStrategyExecutor
NewNixpacksStrategyExecutor creates a new NixpacksStrategyExecutor.
func (*NixpacksStrategyExecutor) Execute ¶
func (e *NixpacksStrategyExecutor) Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
Execute runs the build using Nixpacks. Nixpacks strategy always produces OCI images.
func (*NixpacksStrategyExecutor) GenerateFlake ¶
func (e *NixpacksStrategyExecutor) GenerateFlake(ctx context.Context, detection *models.DetectionResult, config models.BuildConfig) (string, error)
GenerateFlake returns empty string as Nixpacks doesn't use flakes. Nixpacks generates its own build plan.
func (*NixpacksStrategyExecutor) Supports ¶
func (e *NixpacksStrategyExecutor) Supports(strategy models.BuildStrategy) bool
Supports returns true if this executor handles the given strategy.
type OCIBuildResult ¶
OCIBuildResult holds the result of an OCI build.
type OCIBuilder ¶
type OCIBuilder interface {
BuildWithLogCallback(ctx context.Context, job *models.BuildJob, callback func(line string)) (*OCIBuildResult, error)
}
OCIBuilder interface for building OCI images.
type PreBuildResult ¶
type PreBuildResult struct {
// RepoPath is the path to the cloned repository
RepoPath string
// Detection contains the detection results
Detection *models.DetectionResult
// CommitSHA is the resolved commit SHA
CommitSHA string
// CloneDuration is how long the clone took
CloneDuration time.Duration
// DetectionDuration is how long detection took
DetectionDuration time.Duration
// CacheHit indicates whether the detection result came from cache
// **Validates: Requirements 4.3**
CacheHit bool
}
PreBuildResult contains the results of the pre-build phase. **Validates: Requirements 1.1, 1.2**
type StrategyExecutor ¶
type StrategyExecutor interface {
// Execute runs the build strategy.
Execute(ctx context.Context, job *models.BuildJob) (*BuildResult, error)
// ExecuteWithLogs runs the build strategy with real-time log streaming.
// The logCallback will be invoked for each log line produced during the build.
ExecuteWithLogs(ctx context.Context, job *models.BuildJob, logCallback LogCallback) (*BuildResult, error)
// Supports returns true if this executor handles the given strategy.
Supports(strategy models.BuildStrategy) bool
// GenerateFlake generates a flake.nix for this strategy (if applicable).
// Returns empty string if the strategy doesn't generate flakes.
GenerateFlake(ctx context.Context, detection *models.DetectionResult, config models.BuildConfig) (string, error)
}
StrategyExecutor executes a specific build strategy.