Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Fixes issues from code review of resilience implementation:
- Wire saga system in main.go (SagaRepository, SagaExecutor, SagaHandler)
- Fix CompletedSteps() to include skipped steps for dependency resolution
- Fix reverse loop bug in saga compensation (use standard swap pattern)
- Add circuit breaker state change callbacks for Prometheus metrics
Phase 1 (Build Resilience):
- Add failure:retry to all component Kaniko build steps
- Add preflight registry health check before builds
- Add services-deployed sync point to decouple docs from critical path
Phase 2 (API Resilience):
- Add pipeline retry endpoint (POST /projects/{id}/pipelines/{number}/retry)
- Wire circuit breakers with metrics callbacks
- Add /health/circuits endpoint for circuit breaker status
Phase 3 (Saga Engine):
- Full domain model (Saga, SagaStep, RetryPolicy, BackoffType)
- PostgreSQL saga repository with CRUD and step management
- Saga executor with retry, compensation, skip step support
- Saga API handlers with CRUD and control operations
Phase 4 (Observability):
- Add saga metrics (total, step_duration, retry, circuit_breaker_state)
- Add logging fields (saga_id, saga_name, step_name)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
51 lines
2.2 KiB
Go
51 lines
2.2 KiB
Go
// Package port defines interfaces (ports) for external dependencies.
|
|
package port
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/orchard9/rdev/internal/domain"
|
|
)
|
|
|
|
// CIProvider manages CI/CD pipeline configurations.
|
|
// Implementations include Woodpecker, GitHub Actions, GitLab CI, etc.
|
|
type CIProvider interface {
|
|
// ActivateRepo enables CI for a repository.
|
|
// The forge is the git forge (e.g., gitea, github) where the repo lives.
|
|
// This creates the necessary webhooks and enables the CI pipeline.
|
|
ActivateRepo(ctx context.Context, forge, owner, repo string) (*domain.CIRepo, error)
|
|
|
|
// DeactivateRepo disables CI for a repository.
|
|
DeactivateRepo(ctx context.Context, owner, repo string) error
|
|
|
|
// GetRepo returns the CI configuration for a repository.
|
|
GetRepo(ctx context.Context, owner, repo string) (*domain.CIRepo, error)
|
|
|
|
// ListRepos returns all repositories visible to the CI system.
|
|
ListRepos(ctx context.Context) ([]*domain.CIRepo, error)
|
|
|
|
// AddSecret adds a secret to a repository for use in pipelines.
|
|
AddSecret(ctx context.Context, owner, repo string, secret domain.CISecret) error
|
|
|
|
// DeleteSecret removes a secret from a repository.
|
|
DeleteSecret(ctx context.Context, owner, repo, secretName string) error
|
|
|
|
// ListPipelines returns recent CI pipeline executions for a repository.
|
|
ListPipelines(ctx context.Context, owner, repo string) ([]*domain.CIPipeline, error)
|
|
|
|
// GetPipeline returns a specific pipeline execution by number.
|
|
GetPipeline(ctx context.Context, owner, repo string, number int64) (*domain.CIPipeline, error)
|
|
|
|
// GetPipelineSteps returns detailed step information for a pipeline.
|
|
// For failed steps, includes the last N lines of log output.
|
|
GetPipelineSteps(ctx context.Context, owner, repo string, number int64) (*domain.CIPipelineSteps, error)
|
|
|
|
// TriggerBuild manually starts a new pipeline build on the specified branch.
|
|
// Returns the pipeline number of the triggered build.
|
|
TriggerBuild(ctx context.Context, owner, repo, branch string) (int64, error)
|
|
|
|
// RetryPipeline restarts a failed or stopped pipeline.
|
|
// Returns the restarted pipeline information.
|
|
RetryPipeline(ctx context.Context, owner, repo string, number int64) (*domain.CIPipeline, error)
|
|
}
|