Documentation
¶
Index ¶
Constants ¶
const ( // DefaultTimeoutSec is used when a sync has no per-sync timeout // configured. DefaultTimeoutSec = 60 // DefaultMaxTimeoutSec mirrors the settings default so callers // always have a sane upper bound even if settings can't be loaded. DefaultMaxTimeoutSec = 300 )
Lifecycle hook configuration limits and conventions.
Variables ¶
This section is empty.
Functions ¶
func ParseEnvText ¶
ParseEnvText reads admin-configured env config as the same KEY=VALUE text format used by .env files: one entry per line, blank and "#"-prefixed lines ignored, keys must match POSIX identifier syntax. Reuses the strict parser also used for stdout-capture.
func ParseExtraMountsText ¶
func ParseExtraMountsText(raw *string) ([]lifecycletype.ExtraMount, error)
ParseExtraMountsText reads admin-configured bind mounts in docker-CLI "src:tgt[:ro|:rw]" form, one per line. Blank and "#"-prefixed lines are ignored. Both source and target must be absolute paths; mode defaults to read-write.
Types ¶
type LifecycleService ¶
type LifecycleService struct {
// contains filtered or unexported fields
}
LifecycleService runs pre-deploy lifecycle hooks declared on a project's GitOps sync. A hook is a script in the synced repo executed in a throwaway container immediately before the project is deployed, with optional capture of stdout as environment variables merged into the compose env.
Trust model: the script is repo-trusted code, equivalent to compose.yaml in the same repo. Anyone who can push to that repo can change what the script does on the next deploy. The trust event is configuring a script path on the GitOps sync, not each individual deploy.
func NewLifecycleService ¶
func NewLifecycleService(db *database.DB, settingsService *settings.SettingsService, eventService *event.EventService, dockerService *docker.DockerClientService) *LifecycleService
NewLifecycleService constructs a LifecycleService wired against shared infrastructure. The Docker client is obtained lazily on each hook run via dockerService.GetClient so reconnects are transparent.
func (*LifecycleService) RunPreDeploy ¶
func (s *LifecycleService) RunPreDeploy(ctx context.Context, project *models.Project, actor models.User) error
RunPreDeploy executes the pre-deploy lifecycle hook for a project, if one is configured on its GitOps sync.
Callers should invoke this unconditionally before deploying — when no hook is configured, when lifecycle hooks are disabled globally, or when the project is not GitOps-managed, this is a no-op and returns nil.
A non-zero exit code, a script timeout, or any infrastructure failure returns an error that aborts the deploy. The last-run state on the GitOpsSync row is updated on every invocation that reaches the run step, regardless of outcome.