rdev/internal/port/ci_provider.go
jordan c86516c53a feat: Add multi-domain support with auto-generated slugs for landing page cookbook
Landing page cookbook implementation (Weeks 1-4):

Domain Infrastructure:
- Add project_domains table with migration (013_project_domains.sql)
- Add ProjectDomain model with domain types (primary_auto, primary_custom, alias)
- Add SlugGenerator and ProjectDomainRepository interfaces
- Implement postgres adapters for domain and slug management

Service Layer:
- Add domain CRUD methods to ProjectInfraService
- Generate 8-char random slugs for auto-domains
- Support custom subdomains during project creation
- Add site_live health check to project status
- Trigger CI build after template seeding

Handler Updates:
- Add DomainService interface and adapter pattern
- Rewrite domain handlers to use database-backed service
- Add proper error handling for duplicate/missing domains

CI Integration:
- Add TriggerBuild to CIProvider interface
- Implement TriggerBuild in Woodpecker adapter
- Manually trigger initial build after template seed

Cookbook & Scripts:
- Add landing-test.sh script for E2E testing
- Add release.sh for version releases
- Add logs.sh for quick log access

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 12:55:59 -07:00

43 lines
1.7 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)
// 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)
}