Three coordinated fixes for CI pipeline race conditions:
1. Woodpecker step dependencies: Added depends_on: [deps] to all 6 component
templates (service, worker, cli, app-astro, app-react, app-nextjs) so build
steps wait for go work sync to complete.
2. Idempotent resource provisioning: Modified provisionResources() to check
for existing database/cache before creating, preventing "already exists"
errors on component re-adds.
3. Batch component endpoint: POST /projects/{id}/components/batch enables
atomic multi-component additions in a single git commit. Validates all
components upfront, provisions infra sequentially, commits code components
atomically.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
33 lines
1.4 KiB
Go
33 lines
1.4 KiB
Go
// Package port defines interfaces (ports) for external dependencies.
|
|
package port
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/orchard9/rdev/internal/domain"
|
|
)
|
|
|
|
// ComponentService manages components within monorepo projects.
|
|
type ComponentService interface {
|
|
// AddComponent adds a new component to a project's monorepo.
|
|
AddComponent(ctx context.Context, projectID string, req AddComponentRequest) (*domain.Component, error)
|
|
|
|
// AddComponentBatch adds multiple components in a single atomic operation.
|
|
// All components are validated upfront, then committed in a single git commit.
|
|
AddComponentBatch(ctx context.Context, projectID string, reqs []AddComponentRequest) ([]*domain.Component, error)
|
|
|
|
// ListComponents lists all components in a project's monorepo.
|
|
ListComponents(ctx context.Context, projectID string) ([]domain.Component, error)
|
|
|
|
// RemoveComponent removes a component from a project's monorepo.
|
|
RemoveComponent(ctx context.Context, projectID string, componentPath string) error
|
|
}
|
|
|
|
// AddComponentRequest contains the parameters for adding a component.
|
|
type AddComponentRequest struct {
|
|
Type string `json:"type"` // service, worker, app-astro, app-react, cli
|
|
Name string `json:"name"` // component name (slug format)
|
|
Template string `json:"template"` // optional: specific template variant
|
|
Port int `json:"port"` // optional: specific port (auto-assigned if 0)
|
|
}
|