Documentation
¶
Overview ¶
Package gitops owns GitOps synchronization, scheduling, persistence, and routes.
Index ¶
- func RegisterGitOpsSyncs(api huma.API, syncService *GitOpsSyncService)
- type BackupHistoryInput
- type BackupPreviewInput
- type BackupRevisionInput
- type BrowseSyncFilesInput
- type CreateGitOpsSyncInput
- type DeleteGitOpsSyncInput
- type GetGitOpsSyncInput
- type GetSyncStatusInput
- type GitOpsSyncHandler
- func (h *GitOpsSyncHandler) BackupHistory(ctx context.Context, input *BackupHistoryInput) (*handlerutil.Out[gitops.BackupHistoryResponse], error)
- func (h *GitOpsSyncHandler) BackupRevision(ctx context.Context, input *BackupRevisionInput) (*handlerutil.Out[gitops.BackupRevision], error)
- func (h *GitOpsSyncHandler) BrowseFiles(ctx context.Context, input *BrowseSyncFilesInput) (*handlerutil.Out[gitops.BrowseResponse], error)
- func (h *GitOpsSyncHandler) CreateSync(ctx context.Context, input *CreateGitOpsSyncInput) (*handlerutil.Out[gitops.GitOpsSync], error)
- func (h *GitOpsSyncHandler) DeleteSync(ctx context.Context, input *DeleteGitOpsSyncInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *GitOpsSyncHandler) GetStatus(ctx context.Context, input *GetSyncStatusInput) (*handlerutil.Out[gitops.SyncStatus], error)
- func (h *GitOpsSyncHandler) GetSync(ctx context.Context, input *GetGitOpsSyncInput) (*handlerutil.Out[gitops.GitOpsSync], error)
- func (h *GitOpsSyncHandler) ImportSyncs(ctx context.Context, input *ImportGitOpsSyncsInput) (*handlerutil.Out[gitops.ImportGitOpsSyncResponse], error)
- func (h *GitOpsSyncHandler) ListSyncs(ctx context.Context, input *ListGitOpsSyncsInput) (*ListGitOpsSyncsOutput, error)
- func (h *GitOpsSyncHandler) PerformSync(ctx context.Context, input *PerformSyncInput) (*handlerutil.Out[gitops.SyncResult], error)
- func (h *GitOpsSyncHandler) PreviewBackup(ctx context.Context, input *BackupPreviewInput) (*handlerutil.Out[gitops.BackupPreview], error)
- func (h *GitOpsSyncHandler) ResolveBackupConflict(ctx context.Context, input *ResolveBackupConflictInput) (*handlerutil.Out[gitops.SyncResult], error)
- func (h *GitOpsSyncHandler) UpdateSync(ctx context.Context, input *UpdateGitOpsSyncInput) (*handlerutil.Out[gitops.GitOpsSync], error)
- type GitOpsSyncService
- func (s *GitOpsSyncService) BrowseFiles(ctx context.Context, environmentID, id, localPath string) (*gitops.BrowseResponse, error)
- func (s *GitOpsSyncService) CleanupLeakedCloneDirsOnStartup(ctx context.Context) error
- func (s *GitOpsSyncService) CleanupLeakedScratchDirsOnStartup(ctx context.Context) error
- func (s *GitOpsSyncService) CleanupOrphanedSyncsOnStartup(ctx context.Context) error
- func (s *GitOpsSyncService) CreateSync(ctx context.Context, environmentID string, req gitops.CreateSyncRequest, ...) (*projectpkg.GitOpsSync, error)
- func (s *GitOpsSyncService) DeleteSync(ctx context.Context, environmentID, id string, actor user.Actor) error
- func (s *GitOpsSyncService) GetBackupHistory(ctx context.Context, environmentID, id string, limit int) (*gitops.BackupHistoryResponse, error)
- func (s *GitOpsSyncService) GetBackupRevision(ctx context.Context, environmentID, id, commit string) (*gitops.BackupRevision, error)
- func (s *GitOpsSyncService) GetSyncByID(ctx context.Context, environmentID, id string) (*projectpkg.GitOpsSync, error)
- func (s *GitOpsSyncService) GetSyncStatus(ctx context.Context, environmentID, id string) (*gitops.SyncStatus, error)
- func (s *GitOpsSyncService) GetSyncsPaginated(ctx context.Context, environmentID string, params pagination.QueryParams) ([]gitops.GitOpsSync, pagination.Response, gitops.SyncCounts, error)
- func (s *GitOpsSyncService) ImportSyncs(ctx context.Context, environmentID string, ...) (*gitops.ImportGitOpsSyncResponse, error)
- func (s *GitOpsSyncService) PerformSync(ctx context.Context, environmentID, id string, actor user.Actor) (*gitops.SyncResult, error)
- func (s *GitOpsSyncService) PreviewBackup(ctx context.Context, environmentID, id string) (*gitops.BackupPreview, error)
- func (s *GitOpsSyncService) ReconcileDirectorySyncProjectsOnStartup(ctx context.Context) error
- func (s *GitOpsSyncService) ReconcileInterruptedBackupsOnStartup(ctx context.Context, protectedIDs ...string) error
- func (s *GitOpsSyncService) RegisterAutoSyncJobsOnStartup(ctx context.Context)
- func (s *GitOpsSyncService) RegisterWorkflows(engine *flow.Engine) error
- func (s *GitOpsSyncService) ResolveBackupConflict(ctx context.Context, environmentID, id string, ...) (*gitops.SyncResult, error)
- func (s *GitOpsSyncService) SetScheduler(ctx context.Context, jobScheduler scheduler.DynamicScheduler, ...) error
- func (s *GitOpsSyncService) SubscribeProjectFileChanges(ctx context.Context)
- func (s *GitOpsSyncService) UpdateSync(ctx context.Context, environmentID, id string, req gitops.UpdateSyncRequest, ...) (*projectpkg.GitOpsSync, error)
- type ImportGitOpsSyncsInput
- type ListGitOpsSyncsInput
- type ListGitOpsSyncsOutput
- type Module
- type PerformSyncInput
- type ResolveBackupConflictInput
- type UpdateGitOpsSyncInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterGitOpsSyncs ¶
func RegisterGitOpsSyncs(api huma.API, syncService *GitOpsSyncService)
RegisterGitOpsSyncs registers all GitOps sync endpoints.
Types ¶
type BackupHistoryInput ¶ added in v2.12.0
type BackupPreviewInput ¶ added in v2.12.0
type BackupRevisionInput ¶ added in v2.12.0
type BrowseSyncFilesInput ¶
type CreateGitOpsSyncInput ¶
type CreateGitOpsSyncInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
Body gitops.CreateSyncRequest
}
type DeleteGitOpsSyncInput ¶
type GetGitOpsSyncInput ¶
type GetSyncStatusInput ¶
type GitOpsSyncHandler ¶
type GitOpsSyncHandler struct {
// contains filtered or unexported fields
}
GitOpsSyncHandler handles GitOps sync management endpoints.
func (*GitOpsSyncHandler) BackupHistory ¶ added in v2.12.0
func (h *GitOpsSyncHandler) BackupHistory(ctx context.Context, input *BackupHistoryInput) (*handlerutil.Out[gitops.BackupHistoryResponse], error)
BackupHistory lists revisions affecting the backup.
func (*GitOpsSyncHandler) BackupRevision ¶ added in v2.12.0
func (h *GitOpsSyncHandler) BackupRevision(ctx context.Context, input *BackupRevisionInput) (*handlerutil.Out[gitops.BackupRevision], error)
BackupRevision returns one revision with diffs.
func (*GitOpsSyncHandler) BrowseFiles ¶
func (h *GitOpsSyncHandler) BrowseFiles(ctx context.Context, input *BrowseSyncFilesInput) (*handlerutil.Out[gitops.BrowseResponse], error)
BrowseFiles returns the file tree at the specified path in the repository.
func (*GitOpsSyncHandler) CreateSync ¶
func (h *GitOpsSyncHandler) CreateSync(ctx context.Context, input *CreateGitOpsSyncInput) (*handlerutil.Out[gitops.GitOpsSync], error)
CreateSync creates a new GitOps sync.
func (*GitOpsSyncHandler) DeleteSync ¶
func (h *GitOpsSyncHandler) DeleteSync(ctx context.Context, input *DeleteGitOpsSyncInput) (*handlerutil.Out[base.MessageResponse], error)
DeleteSync deletes a GitOps sync by ID.
func (*GitOpsSyncHandler) GetStatus ¶
func (h *GitOpsSyncHandler) GetStatus(ctx context.Context, input *GetSyncStatusInput) (*handlerutil.Out[gitops.SyncStatus], error)
GetStatus returns the current status of a GitOps sync.
func (*GitOpsSyncHandler) GetSync ¶
func (h *GitOpsSyncHandler) GetSync(ctx context.Context, input *GetGitOpsSyncInput) (*handlerutil.Out[gitops.GitOpsSync], error)
GetSync returns a GitOps sync by ID.
func (*GitOpsSyncHandler) ImportSyncs ¶
func (h *GitOpsSyncHandler) ImportSyncs(ctx context.Context, input *ImportGitOpsSyncsInput) (*handlerutil.Out[gitops.ImportGitOpsSyncResponse], error)
ImportSyncs imports multiple GitOps syncs.
func (*GitOpsSyncHandler) ListSyncs ¶
func (h *GitOpsSyncHandler) ListSyncs(ctx context.Context, input *ListGitOpsSyncsInput) (*ListGitOpsSyncsOutput, error)
ListSyncs returns a paginated list of GitOps syncs.
func (*GitOpsSyncHandler) PerformSync ¶
func (h *GitOpsSyncHandler) PerformSync(ctx context.Context, input *PerformSyncInput) (*handlerutil.Out[gitops.SyncResult], error)
PerformSync manually triggers a sync operation.
func (*GitOpsSyncHandler) PreviewBackup ¶ added in v2.12.0
func (h *GitOpsSyncHandler) PreviewBackup(ctx context.Context, input *BackupPreviewInput) (*handlerutil.Out[gitops.BackupPreview], error)
PreviewBackup shows what the next backup would commit.
func (*GitOpsSyncHandler) ResolveBackupConflict ¶ added in v2.12.0
func (h *GitOpsSyncHandler) ResolveBackupConflict(ctx context.Context, input *ResolveBackupConflictInput) (*handlerutil.Out[gitops.SyncResult], error)
ResolveBackupConflict resolves a backup that needs attention.
func (*GitOpsSyncHandler) UpdateSync ¶
func (h *GitOpsSyncHandler) UpdateSync(ctx context.Context, input *UpdateGitOpsSyncInput) (*handlerutil.Out[gitops.GitOpsSync], error)
UpdateSync updates an existing GitOps sync.
type GitOpsSyncService ¶
type GitOpsSyncService struct {
// contains filtered or unexported fields
}
func NewGitOpsSyncService ¶
func NewGitOpsSyncService( db *database.DB, repoService *gitrepo.GitRepositoryService, projectService *projectpkg.ProjectService, swarmService *swarm.SwarmService, eventService *event.EventService, settingsService *settings.SettingsService, ) *GitOpsSyncService
func (*GitOpsSyncService) BrowseFiles ¶
func (s *GitOpsSyncService) BrowseFiles(ctx context.Context, environmentID, id, localPath string) (*gitops.BrowseResponse, error)
func (*GitOpsSyncService) CleanupLeakedCloneDirsOnStartup ¶ added in v2.10.0
func (s *GitOpsSyncService) CleanupLeakedCloneDirsOnStartup(ctx context.Context) error
CleanupLeakedCloneDirsOnStartup removes leaked git clone scratch dirs ("gitops-*") under the git work dir; safe because no sync holds a clone yet.
func (*GitOpsSyncService) CleanupLeakedScratchDirsOnStartup ¶
func (s *GitOpsSyncService) CleanupLeakedScratchDirsOnStartup(ctx context.Context) error
CleanupLeakedScratchDirsOnStartup removes GitOps scratch directories an interrupted sync left in the projects directory, which discovery would import as phantom projects. It runs before any sync job is registered.
func (*GitOpsSyncService) CleanupOrphanedSyncsOnStartup ¶
func (s *GitOpsSyncService) CleanupOrphanedSyncsOnStartup(ctx context.Context) error
func (*GitOpsSyncService) CreateSync ¶
func (s *GitOpsSyncService) CreateSync(ctx context.Context, environmentID string, req gitops.CreateSyncRequest, actor user.Actor) (*projectpkg.GitOpsSync, error)
func (*GitOpsSyncService) DeleteSync ¶
func (*GitOpsSyncService) GetBackupHistory ¶ added in v2.12.0
func (s *GitOpsSyncService) GetBackupHistory(ctx context.Context, environmentID, id string, limit int) (*gitops.BackupHistoryResponse, error)
GetBackupHistory lists revisions that touched the backup directory.
func (*GitOpsSyncService) GetBackupRevision ¶ added in v2.12.0
func (s *GitOpsSyncService) GetBackupRevision(ctx context.Context, environmentID, id, commit string) (*gitops.BackupRevision, error)
GetBackupRevision returns one revision with per-file diffs inside the backup directory.
func (*GitOpsSyncService) GetSyncByID ¶
func (s *GitOpsSyncService) GetSyncByID(ctx context.Context, environmentID, id string) (*projectpkg.GitOpsSync, error)
func (*GitOpsSyncService) GetSyncStatus ¶
func (s *GitOpsSyncService) GetSyncStatus(ctx context.Context, environmentID, id string) (*gitops.SyncStatus, error)
func (*GitOpsSyncService) GetSyncsPaginated ¶
func (s *GitOpsSyncService) GetSyncsPaginated(ctx context.Context, environmentID string, params pagination.QueryParams) ([]gitops.GitOpsSync, pagination.Response, gitops.SyncCounts, error)
func (*GitOpsSyncService) ImportSyncs ¶
func (s *GitOpsSyncService) ImportSyncs(ctx context.Context, environmentID string, req []gitops.ImportGitOpsSyncRequest, actor user.Actor) (*gitops.ImportGitOpsSyncResponse, error)
func (*GitOpsSyncService) PerformSync ¶
func (s *GitOpsSyncService) PerformSync(ctx context.Context, environmentID, id string, actor user.Actor) (*gitops.SyncResult, error)
func (*GitOpsSyncService) PreviewBackup ¶ added in v2.12.0
func (s *GitOpsSyncService) PreviewBackup(ctx context.Context, environmentID, id string) (*gitops.BackupPreview, error)
PreviewBackup reports what the next backup run would commit or why it needs attention.
func (*GitOpsSyncService) ReconcileDirectorySyncProjectsOnStartup ¶
func (s *GitOpsSyncService) ReconcileDirectorySyncProjectsOnStartup(ctx context.Context) error
func (*GitOpsSyncService) ReconcileInterruptedBackupsOnStartup ¶ added in v2.12.0
func (s *GitOpsSyncService) ReconcileInterruptedBackupsOnStartup(ctx context.Context, protectedIDs ...string) error
ReconcileInterruptedBackupsOnStartup turns backups left running by a restart into pending failures.
func (*GitOpsSyncService) RegisterAutoSyncJobsOnStartup ¶
func (s *GitOpsSyncService) RegisterAutoSyncJobsOnStartup(ctx context.Context)
RegisterAutoSyncJobsOnStartup registers a job for every auto-sync and kicks the overdue ones, and backups with pending changes, right away.
func (*GitOpsSyncService) RegisterWorkflows ¶ added in v2.16.0
func (s *GitOpsSyncService) RegisterWorkflows(engine *flow.Engine) error
RegisterWorkflows defines the gitops-sync workflow each scheduled sync runs. A sync step retries transient clone failures; a retry replays the run's pinned revision.
func (*GitOpsSyncService) ResolveBackupConflict ¶ added in v2.12.0
func (s *GitOpsSyncService) ResolveBackupConflict(ctx context.Context, environmentID, id string, req gitops.ResolveBackupConflictRequest, actor user.Actor) (*gitops.SyncResult, error)
ResolveBackupConflict applies the chosen strategy to a backup that needs attention.
func (*GitOpsSyncService) SetScheduler ¶
func (s *GitOpsSyncService) SetScheduler(ctx context.Context, jobScheduler scheduler.DynamicScheduler, admissionGate *runs.Admission) error
SetScheduler injects the scheduler, the admission gate, and the app lifecycle context background syncs run on. It must run during bootstrap, before any per-sync job is registered.
func (*GitOpsSyncService) SubscribeProjectFileChanges ¶ added in v2.12.0
func (s *GitOpsSyncService) SubscribeProjectFileChanges(ctx context.Context)
SubscribeProjectFileChanges marks backups pending on save and runs them after a debounce when auto backup is on.
func (*GitOpsSyncService) UpdateSync ¶
func (s *GitOpsSyncService) UpdateSync(ctx context.Context, environmentID, id string, req gitops.UpdateSyncRequest, actor user.Actor) (*projectpkg.GitOpsSync, error)
type ImportGitOpsSyncsInput ¶
type ImportGitOpsSyncsInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
Body []gitops.ImportGitOpsSyncRequest
}
type ListGitOpsSyncsInput ¶
type ListGitOpsSyncsInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
Search string `query:"search" doc:"Search query"`
Sort string `query:"sort" doc:"Column to sort by"`
Order string `query:"order" default:"asc" doc:"Sort direction"`
Start int `query:"start" default:"0" doc:"Start index"`
Limit int `query:"limit" default:"20" doc:"Items per page"`
Mode string `query:"mode" doc:"Filter by direction (deploy or backup)"`
ProjectID string `query:"projectId" doc:"Filter by linked project ID"`
RepositoryID string `query:"repositoryId" doc:"Filter by repository ID"`
AutoSync string `query:"autoSync" doc:"Filter by automatic sync (true or false)"`
}
type ListGitOpsSyncsOutput ¶
type ListGitOpsSyncsOutput struct {
Body base.PaginatedWithCounts[gitops.GitOpsSync, gitops.SyncCounts]
}
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func New ¶
func New(service *GitOpsSyncService) *Module
func (*Module) RegisterRoutes ¶
func (*Module) Service ¶
func (m *Module) Service() *GitOpsSyncService
type PerformSyncInput ¶
type ResolveBackupConflictInput ¶ added in v2.12.0
type ResolveBackupConflictInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
SyncID string `path:"syncId" doc:"Sync ID"`
Body gitops.ResolveBackupConflictRequest
}
type UpdateGitOpsSyncInput ¶
type UpdateGitOpsSyncInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
SyncID string `path:"syncId" doc:"Sync ID"`
Body gitops.UpdateSyncRequest
}
Directories
¶
| Path | Synopsis |
|---|---|
|
children
|
|
|
backup
Package backup commits saved project files to a Git branch and reports the remote backup state, history and revisions.
|
Package backup commits saved project files to a Git branch and reports the remote backup state, history and revisions. |
|
sync
Package sync applies deployment GitOps syncs: it clones the source, stages and promotes project files, and redeploys the linked project or stack.
|
Package sync applies deployment GitOps syncs: it clones the source, stages and promotes project files, and redeploys the linked project or stack. |