// 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) }