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

gitops

package
v2.13.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: BSD-3-Clause Imports: 46 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 string, path 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 orphaned GitOps scratch directories (.gitops-sync-stage-*, .gitops-backup-*, and the legacy "<name>.gitops-backup-<digits>" form) left in the projects directory by a crash or container restart that interrupted a sync mid-flight. These are Arcane-internal working dirs; left in place the filesystem discovery imports them as phantom projects. It is safe to run at startup because it executes before any sync job is registered, so nothing is mid-stage.

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 common.User) (*projectpkg.GitOpsSync, error)

func (*GitOpsSyncService) DeleteSync

func (s *GitOpsSyncService) DeleteSync(ctx context.Context, environmentID, id string, actor common.User) 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 common.User) (*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) 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 dynamic job for every auto-sync-enabled sync and kicks an immediate run for any that are overdue. This replaces the old global polling job so existing syncs keep running after upgrade.

func (*GitOpsSyncService) ResolveBackupConflict added in v2.12.0

func (s *GitOpsSyncService) ResolveBackupConflict(ctx context.Context, environmentID, id string, req gitops.ResolveBackupConflictRequest, actor common.User) (*gitops.SyncResult, error)

ResolveBackupConflict applies the chosen strategy to a backup that needs attention.

func (*GitOpsSyncService) SetScheduler

func (s *GitOpsSyncService) SetScheduler(ctx context.Context, scheduler schedulertypes.DynamicScheduler, admissionGate *actors.Gate[actors.AdmissionKey]) error

SetScheduler injects the job scheduler and the app lifecycle context. It must be called during bootstrap (after the service graph is built) before any per-sync jobs are registered. The lifecycle context is used for background sync kicks so they outlive the request/bootstrap goroutine that triggered them.

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 common.User) (*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
}

Jump to

Keyboard shortcuts

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