Documentation
¶
Overview ¶
Package builds coordinates build lifecycle between DB and builder.
Index ¶
- func ImageTag(tenantID, serviceID, buildID string) string
- type Build
- type DeployFunc
- type Manager
- func (m *Manager) CancelAllForTenant(ctx context.Context, tenantID string) error
- func (m *Manager) CancelBuild(ctx context.Context, tenantID, buildID string) error
- func (m *Manager) GetBuild(ctx context.Context, tenantID, buildID string) (*Build, error)
- func (m *Manager) GetBuildLogs(ctx context.Context, tenantID, buildID string) (string, error)
- func (m *Manager) ListBuilds(ctx context.Context, tenantID, serviceID string) ([]*Build, error)
- func (m *Manager) ListTenantBuilds(ctx context.Context, tenantID string, limit int) ([]*Build, error)
- func (m *Manager) StartBuild(ctx context.Context, tenantID, serviceID string, req StartBuildRequest) (*Build, error)
- func (m *Manager) StreamBuildLogs(ctx context.Context, tenantID, buildID string, w io.Writer) error
- type StartBuildRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Build ¶
type Build struct {
ID string `json:"id"`
ServiceID string `json:"service_id"`
ServiceName string `json:"service_name,omitempty"`
TenantID string `json:"tenant_id"`
Status string `json:"status"`
SourceType string `json:"source_type"`
SourceURL string `json:"source_url,omitempty"`
SourceRef string `json:"source_ref"`
Image string `json:"image,omitempty"`
NixpacksPlan string `json:"nixpacks_plan,omitempty"`
Log string `json:"-"`
StartedAt *int64 `json:"started_at,omitempty"`
FinishedAt *int64 `json:"finished_at,omitempty"`
CreatedAt int64 `json:"created_at"`
}
Build represents a build record.
type DeployFunc ¶
DeployFunc is called when a build succeeds to deploy the resulting image. The buildID parameter links the deployment to the originating build record.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager coordinates build lifecycle.
func NewManager ¶
func NewManager(db *sql.DB, b buildExecutor, deployFn DeployFunc) *Manager
NewManager creates a build manager.
func (*Manager) CancelAllForTenant ¶
CancelAllForTenant cancels all pending and running builds for a tenant. Used during tenant suspension to free build slots and prevent orphaned builds.
func (*Manager) CancelBuild ¶
CancelBuild cancels a running build.
func (*Manager) GetBuildLogs ¶
GetBuildLogs returns the full build log.
func (*Manager) ListBuilds ¶
ListBuilds returns builds for a service, scoped to tenant.
func (*Manager) ListTenantBuilds ¶
func (m *Manager) ListTenantBuilds(ctx context.Context, tenantID string, limit int) ([]*Build, error)
ListTenantBuilds returns recent builds across all services for a tenant.
func (*Manager) StartBuild ¶
func (m *Manager) StartBuild(ctx context.Context, tenantID, serviceID string, req StartBuildRequest) (*Build, error)
StartBuild creates a build record and starts the build asynchronously.
type StartBuildRequest ¶
type StartBuildRequest struct {
SourceType string `json:"source_type"`
SourceURL string `json:"source_url"`
SourceRef string `json:"source_ref"`
}
StartBuildRequest holds parameters for starting a build.