Help us shape the future of Go! Take the 2026 Go Developer Survey

gitops

package
v2.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2026 License: BSD-3-Clause Imports: 49 Imported by: 0

Documentation

Overview

Package gitops owns GitOps synchronization, scheduling, persistence, and routes.

Index

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 BackupHistoryInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	SyncID        string `path:"syncId" doc:"Sync ID"`
	Limit         int    `query:"limit" default:"20" doc:"Maximum number of revisions"`
}

type BackupPreviewInput added in v2.12.0

type BackupPreviewInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	SyncID        string `path:"syncId" doc:"Sync ID"`
}

type BackupRevisionInput added in v2.12.0

type BackupRevisionInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	SyncID        string `path:"syncId" doc:"Sync ID"`
	Commit        string `path:"commit" doc:"Commit hash"`
}

type BrowseSyncFilesInput

type BrowseSyncFilesInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	SyncID        string `path:"syncId" doc:"Sync ID"`
	Path          string `query:"path" doc:"Path to browse (optional)"`
}

type CreateGitOpsSyncInput

type CreateGitOpsSyncInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	Body          gitops.CreateSyncRequest
}

type DeleteGitOpsSyncInput

type DeleteGitOpsSyncInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	SyncID        string `path:"syncId" doc:"Sync ID"`
}

type GetGitOpsSyncInput

type GetGitOpsSyncInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	SyncID        string `path:"syncId" doc:"Sync ID"`
}

type GetSyncStatusInput

type GetSyncStatusInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	SyncID        string `path:"syncId" doc:"Sync ID"`
}

type GitOpsSyncHandler

type GitOpsSyncHandler struct {
	// contains filtered or unexported fields
}

GitOpsSyncHandler handles GitOps sync management endpoints.

func (*GitOpsSyncHandler) BackupHistory added in v2.12.0

BackupHistory lists revisions affecting the backup.

func (*GitOpsSyncHandler) BackupRevision added in v2.12.0

BackupRevision returns one revision with diffs.

func (*GitOpsSyncHandler) BrowseFiles

BrowseFiles returns the file tree at the specified path in the repository.

func (*GitOpsSyncHandler) CreateSync

CreateSync creates a new GitOps sync.

func (*GitOpsSyncHandler) DeleteSync

DeleteSync deletes a GitOps sync by ID.

func (*GitOpsSyncHandler) GetStatus

GetStatus returns the current status of a GitOps sync.

func (*GitOpsSyncHandler) GetSync

GetSync returns a GitOps sync by ID.

func (*GitOpsSyncHandler) ImportSyncs

ImportSyncs imports multiple GitOps syncs.

func (*GitOpsSyncHandler) ListSyncs

ListSyncs returns a paginated list of GitOps syncs.

func (*GitOpsSyncHandler) PerformSync

PerformSync manually triggers a sync operation.

func (*GitOpsSyncHandler) PreviewBackup added in v2.12.0

PreviewBackup shows what the next backup would commit.

func (*GitOpsSyncHandler) ResolveBackupConflict added in v2.12.0

ResolveBackupConflict resolves a backup that needs attention.

func (*GitOpsSyncHandler) UpdateSync

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 (s *GitOpsSyncService) DeleteSync(ctx context.Context, environmentID, id string, actor user.Actor) error

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 (*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 (m *Module) RegisterRoutes(api huma.API)

func (*Module) Service

func (m *Module) Service() *GitOpsSyncService

type PerformSyncInput

type PerformSyncInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	SyncID        string `path:"syncId" doc:"Sync ID"`
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL