rdev/internal/domain/ci.go
jordan 1ac8efa4c7 feat: Expose Woodpecker pipeline errors in API response
- Add CIPipelineError struct to domain with Type, Message, IsWarning fields
- Map Woodpecker Pipeline.Errors to domain.CIPipeline.Errors
- Fix migration 013: UUID type for project_id, cast id to text for MD5
- Remove invalid domain data migration (columns don't exist)
- Update release.sh with --deploy flag and migration support
- Fix test nil pointer: check errors in TestAPIKeyRepository_ProjectIDArrayHandling

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

104 lines
2.3 KiB
Go

// Package domain contains core business entities.
package domain
import "time"
// CIRepo represents a repository's CI/CD configuration.
type CIRepo struct {
// ID is the CI system's internal ID for this repo
ID int64
// ForgeRemoteID is the ID from the forge (e.g., Gitea repo ID)
ForgeRemoteID int64
// Owner is the repository owner (org or user)
Owner string
// Name is the repository name
Name string
// FullName is owner/name
FullName string
// CloneURL is the URL to clone the repo
CloneURL string
// Active indicates if CI is enabled for this repo
Active bool
// AllowPullRequests allows PRs to trigger builds
AllowPullRequests bool
// Visibility: public, private, internal
Visibility string
// CreatedAt is when CI was activated
CreatedAt time.Time
// UpdatedAt is when CI config was last modified
UpdatedAt time.Time
}
// CISecret represents a secret for use in CI pipelines.
type CISecret struct {
// Name is the secret name (e.g., "DOCKER_PASSWORD")
Name string
// Value is the secret value (encrypted at rest)
Value string
// Events controls when the secret is available (e.g., "push", "pull_request")
Events []string
// Images limits which container images can use this secret
Images []string
}
// CIPipelineError represents an error from the CI system.
type CIPipelineError struct {
// Type: linter, deprecation, compiler, generic, bad_habit
Type string `json:"type"`
// Message is the error description
Message string `json:"message"`
// IsWarning indicates this is a warning, not a fatal error
IsWarning bool `json:"is_warning"`
}
// CIPipeline represents a CI pipeline execution.
type CIPipeline struct {
// ID is the pipeline ID
ID int64
// Number is the pipeline number (increments per repo)
Number int64
// Status: pending, running, success, failure, killed, blocked, error
Status string
// Event: push, pull_request, tag, cron, manual
Event string
// Branch that triggered the pipeline
Branch string
// Commit SHA
Commit string
// Message is the commit message
Message string
// Author who triggered the pipeline
Author string
// Started timestamp
Started time.Time
// Finished timestamp (zero if still running)
Finished time.Time
// Errors contains any pipeline errors (e.g., YAML validation failures)
Errors []CIPipelineError
}