Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CICDExecutor ¶
type CICDExecutor struct {
// contains filtered or unexported fields
}
CICDExecutor detects and provides information about the CI/CD environment.
func NewCICDExecutor ¶
func NewCICDExecutor() *CICDExecutor
NewCICDExecutor creates a new CICDExecutor.
func (*CICDExecutor) GetDetectedType ¶
func (e *CICDExecutor) GetDetectedType() CICDType
GetDetectedType returns the detected CI/CD type.
func (*CICDExecutor) IsCIEnvironment ¶
func (e *CICDExecutor) IsCIEnvironment() bool
IsCIEnvironment checks if we're running in any CI/CD environment.
type CICDType ¶
type CICDType string
CICDType represents the type of CI/CD system detected.
const ( // CICDTypeGitHubActions represents GitHub Actions. CICDTypeGitHubActions CICDType = "github-actions" // CICDTypeGitLabCI represents GitLab CI. CICDTypeGitLabCI CICDType = "gitlab-ci" // CICDTypeJenkins represents Jenkins. CICDTypeJenkins CICDType = "jenkins" // CICDTypeCircleCI represents CircleCI. CICDTypeCircleCI CICDType = "circleci" // CICDTypeLocal represents local execution (not in CI/CD). CICDTypeLocal CICDType = "local" )
func DetectCICD ¶
DetectCICD detects the CI/CD system from environment variables.
Parameters:
- ctx: The context for managing execution.
Returns:
- The detected CICDType, or CICDTypeLocal if no CI/CD is detected.
type CacheStrategy ¶
type CacheStrategy interface {
Get(ctx context.Context, key string) ([]byte, error)
Set(ctx context.Context, key string, data []byte, ttl interface{}) error
}
CacheStrategy defines the interface for cache strategies. This will be moved to internal/cache in Phase 2.
type DockerExecutor ¶
type DockerExecutor struct {
// contains filtered or unexported fields
}
DockerExecutor executes pipeline steps using Dagger/Docker containers. This is the default executor that uses Dagger for containerized execution.
func NewDockerExecutor ¶
func NewDockerExecutor(client *dagger.Client, config pipelines.Config) *DockerExecutor
NewDockerExecutor creates a new DockerExecutor.
Parameters:
- client: The Dagger client for container operations (can be nil for testing).
- config: The pipeline configuration.
Returns:
- A new DockerExecutor instance.
func (*DockerExecutor) CanExecute ¶
func (e *DockerExecutor) CanExecute(_ context.Context) bool
CanExecute checks if Docker execution is possible. Docker execution requires a valid Dagger client.
func (*DockerExecutor) ExecuteStep ¶
func (e *DockerExecutor) ExecuteStep(ctx context.Context, stepName string) error
ExecuteStep executes a single pipeline step using Dagger.
Parameters:
- ctx: The context for managing execution.
- stepName: The name of the step to execute.
Returns:
- An error if the step execution fails, otherwise nil.
func (*DockerExecutor) GetCacheStrategy ¶
func (e *DockerExecutor) GetCacheStrategy() CacheStrategy
GetCacheStrategy returns nil for Docker executor (cache handled by Dagger).
func (*DockerExecutor) Name ¶
func (e *DockerExecutor) Name() string
Name returns the name of the executor.
func (*DockerExecutor) SupportsParallel ¶
func (e *DockerExecutor) SupportsParallel() bool
SupportsParallel indicates whether Docker executor supports parallel execution.
type Executor ¶
type Executor interface {
// Name returns the name of the executor.
Name() string
// CanExecute checks if this executor can run in the current environment.
CanExecute(ctx context.Context) bool
// ExecuteStep executes a single pipeline step.
ExecuteStep(ctx context.Context, stepName string) error
// SupportsParallel indicates whether this executor supports parallel step execution.
SupportsParallel() bool
// GetCacheStrategy returns the cache strategy used by this executor.
GetCacheStrategy() CacheStrategy
}
Executor defines the interface for pipeline execution backends. Different executors can run steps natively, in Docker, Kubernetes, etc.
type MockExecutor ¶
type MockExecutor struct {
NameFunc func() string
CanExecuteFunc func(ctx context.Context) bool
ExecuteStepFunc func(ctx context.Context, stepName string) error
SupportsParallelFunc func() bool
GetCacheStrategyFunc func() CacheStrategy
}
MockExecutor implements Executor interface for testing.
func NewMockExecutor ¶
func NewMockExecutor() *MockExecutor
NewMockExecutor creates a new MockExecutor with default behavior.
func NewMockExecutorWithError ¶
func NewMockExecutorWithError(err error) *MockExecutor
NewMockExecutorWithError creates a MockExecutor that returns an error on ExecuteStep.
func (*MockExecutor) CanExecute ¶
func (m *MockExecutor) CanExecute(ctx context.Context) bool
CanExecute checks if this executor can run in the current environment.
func (*MockExecutor) ExecuteStep ¶
func (m *MockExecutor) ExecuteStep(ctx context.Context, stepName string) error
ExecuteStep executes a single pipeline step.
func (*MockExecutor) GetCacheStrategy ¶
func (m *MockExecutor) GetCacheStrategy() CacheStrategy
GetCacheStrategy returns the cache strategy used by this executor.
func (*MockExecutor) Name ¶
func (m *MockExecutor) Name() string
Name returns the name of the executor.
func (*MockExecutor) SupportsParallel ¶
func (m *MockExecutor) SupportsParallel() bool
SupportsParallel indicates whether this executor supports parallel step execution.
type NativeExecutor ¶
type NativeExecutor struct {
// contains filtered or unexported fields
}
NativeExecutor executes pipeline steps natively without Docker containers. It uses the Go toolchain and other tools installed on the host system.
func NewNativeExecutor ¶
func NewNativeExecutor(goVersion string, workDir string) *NativeExecutor
NewNativeExecutor creates a new NativeExecutor.
Parameters:
- goVersion: The Go version to use (for compatibility checks).
- workDir: The working directory for execution.
Returns:
- A new NativeExecutor instance.
func (*NativeExecutor) CanExecute ¶
func (e *NativeExecutor) CanExecute(ctx context.Context) bool
CanExecute checks if native execution is possible. Native execution requires Go to be installed on the system.
func (*NativeExecutor) ExecuteStep ¶
func (e *NativeExecutor) ExecuteStep(ctx context.Context, stepName string) error
ExecuteStep executes a single pipeline step natively.
Parameters:
- ctx: The context for managing execution.
- stepName: The name of the step to execute.
Returns:
- An error if the step execution fails, otherwise nil.
func (*NativeExecutor) GetCacheStrategy ¶
func (e *NativeExecutor) GetCacheStrategy() CacheStrategy
GetCacheStrategy returns nil for native executor (cache handled by CI/CD system).
func (*NativeExecutor) Name ¶
func (e *NativeExecutor) Name() string
Name returns the name of the executor.
func (*NativeExecutor) SupportsParallel ¶
func (e *NativeExecutor) SupportsParallel() bool
SupportsParallel indicates whether native executor supports parallel execution.
type Selector ¶
type Selector struct {
// contains filtered or unexported fields
}
Selector selects the appropriate executor based on environment and configuration.
func (*Selector) ListExecutors ¶
ListExecutors returns a list of all registered executor names.
func (*Selector) RegisterExecutor ¶
RegisterExecutor registers an executor with the selector.
func (*Selector) SelectExecutor ¶
func (s *Selector) SelectExecutor(ctx context.Context, _ *dagger.Client, _ pipelines.Config, preferredExecutor string) (Executor, error)
SelectExecutor selects the appropriate executor for the current environment.
Parameters:
- ctx: The context for managing execution.
- client: The Dagger client (can be nil for native execution).
- config: The pipeline configuration.
- preferredExecutor: Preferred executor name (empty for auto-detection).
Returns:
- The selected executor.
- An error if no suitable executor is found.