gitrepo

package
v2.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Overview

Package gitrepo owns configured Git repositories and their HTTP surface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterGitRepositories

func RegisterGitRepositories(api huma.API, repoService *GitRepositoryService)

RegisterGitRepositories registers all git repository endpoints.

Types

type BrowseFilesInput

type BrowseFilesInput struct {
	ID     string `path:"id" doc:"Repository ID"`
	Branch string `query:"branch" doc:"Branch to browse"`
	Path   string `query:"path" doc:"Path within repository (optional)"`
}

type BrowseFilesOutput

type BrowseFilesOutput struct {
	Body base.ApiResponse[gitops.BrowseResponse]
}

type CreateGitRepositoryInput

type CreateGitRepositoryInput struct {
	Body CreateGitRepositoryRequest
}

type CreateGitRepositoryOutput

type CreateGitRepositoryOutput struct {
	Body base.ApiResponse[gitops.GitRepository]
}

type CreateGitRepositoryRequest added in v2.8.1

type CreateGitRepositoryRequest struct {
	Name                   string  `json:"name" binding:"required"`
	URL                    string  `json:"url" binding:"required"`
	AuthType               string  `json:"authType" binding:"required,oneof=none http ssh"`
	Username               string  `json:"username,omitempty"`
	Token                  string  `json:"token,omitempty"`
	SSHKey                 string  `json:"sshKey,omitempty"`
	SSHHostKeyVerification string  `json:"sshHostKeyVerification,omitempty" binding:"omitempty,oneof=strict accept_new skip"`
	Description            *string `json:"description,omitempty"`
	Enabled                *bool   `json:"enabled,omitempty"`
}

type DeleteGitRepositoryInput

type DeleteGitRepositoryInput struct {
	ID string `path:"id" doc:"Repository ID"`
}

type DeleteGitRepositoryOutput

type DeleteGitRepositoryOutput struct {
	Body base.ApiResponse[base.MessageResponse]
}

type Dependencies

type Dependencies struct {
	DB       *database.DB
	WorkDir  string
	Event    *event.EventService
	Settings *settings.SettingsService
}

type GetGitRepositoryInput

type GetGitRepositoryInput struct {
	ID string `path:"id" doc:"Repository ID"`
}

type GetGitRepositoryOutput

type GetGitRepositoryOutput struct {
	Body base.ApiResponse[gitops.GitRepository]
}

type GitRepository added in v2.8.1

type GitRepository struct {
	database.BaseModel

	Name                   string  `json:"name" sortable:"true" search:"git,repository,repo,source,version,control,github,gitlab,bitbucket"`
	URL                    string  `json:"url" sortable:"true" search:"url,git,clone,remote,https,ssh"`
	AuthType               string  `json:"authType" sortable:"true" search:"auth,authentication,credentials,token,ssh,http"` // none, http, ssh
	Username               string  `json:"username" sortable:"true" search:"username,user,login,account"`
	Token                  string  `json:"token" search:"token,password,credentials,secret,auth"` // encrypted
	SSHKey                 string  `json:"sshKey" search:"ssh,key,private,public,certificate"`    // encrypted
	SSHHostKeyVerification string  `json:"sshHostKeyVerification" gorm:"default:accept_new"`      // strict, accept_new, skip
	Description            *string `json:"description,omitempty" sortable:"true"`
	Enabled                bool    `json:"enabled" sortable:"true" search:"enabled,active,disabled"`
}

func (GitRepository) TableName added in v2.8.1

func (GitRepository) TableName() string

type GitRepositoryHandler

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

GitRepositoryHandler handles git repository management endpoints.

func (*GitRepositoryHandler) BrowseFiles

BrowseFiles returns files and directories from a git repository.

func (*GitRepositoryHandler) CreateRepository

CreateRepository creates a new git repository.

func (*GitRepositoryHandler) DeleteRepository

DeleteRepository deletes a git repository by ID.

func (*GitRepositoryHandler) GetRepository

GetRepository returns a git repository by ID.

func (*GitRepositoryHandler) ListBranches

ListBranches returns all branches from a git repository.

func (*GitRepositoryHandler) ListRepositories

ListRepositories returns a paginated list of git repositories.

func (*GitRepositoryHandler) SyncRepositories

SyncRepositories syncs git repositories from a manager to this agent instance.

func (*GitRepositoryHandler) TestRepository

TestRepository tests connectivity and authentication to a git repository.

func (*GitRepositoryHandler) UpdateRepository

UpdateRepository updates an existing git repository.

type GitRepositoryService

type GitRepositoryService struct {
	*git.Client
	// contains filtered or unexported fields
}

func NewGitRepositoryService

func NewGitRepositoryService(db *database.DB, workDir string, eventService *event.EventService, settingsService *settings.SettingsService) *GitRepositoryService

func (*GitRepositoryService) BrowseFiles

func (s *GitRepositoryService) BrowseFiles(ctx context.Context, id, branch, path string) (*gitops.BrowseResponse, error)

func (*GitRepositoryService) CreateRepository

func (*GitRepositoryService) DeleteRepository

func (s *GitRepositoryService) DeleteRepository(ctx context.Context, id string, actor common.User) error

func (*GitRepositoryService) FindEnabledRepositoryByURL

func (s *GitRepositoryService) FindEnabledRepositoryByURL(ctx context.Context, rawURL string) (*GitRepository, error)

func (*GitRepositoryService) GetAuthConfig

func (s *GitRepositoryService) GetAuthConfig(ctx context.Context, repository *GitRepository) (git.AuthConfig, error)

func (*GitRepositoryService) GetRepositoriesPaginated

func (s *GitRepositoryService) GetRepositoriesPaginated(ctx context.Context, params pagination.QueryParams) ([]gitops.GitRepository, pagination.Response, error)

func (*GitRepositoryService) GetRepositoryByID

func (s *GitRepositoryService) GetRepositoryByID(ctx context.Context, id string) (*GitRepository, error)

func (*GitRepositoryService) GetRepositoryByName

func (s *GitRepositoryService) GetRepositoryByName(ctx context.Context, name string) (*GitRepository, error)

func (*GitRepositoryService) ListBranches

func (s *GitRepositoryService) ListBranches(ctx context.Context, id string) ([]gitops.BranchInfo, error)

func (*GitRepositoryService) SyncRepositories

func (s *GitRepositoryService) SyncRepositories(ctx context.Context, syncItems []gitops.RepositorySync) error

SyncRepositories syncs repositories from a manager to this agent instance. It creates, updates, or deletes repositories to match the provided list.

func (*GitRepositoryService) TestConnection

func (s *GitRepositoryService) TestConnection(ctx context.Context, id string, branch string, actor common.User) error

func (*GitRepositoryService) UpdateRepository

type ListBranchesInput

type ListBranchesInput struct {
	ID string `path:"id" doc:"Repository ID"`
}

type ListBranchesOutput

type ListBranchesOutput struct {
	Body base.ApiResponse[gitops.BranchesResponse]
}

type ListGitRepositoriesInput

type ListGitRepositoriesInput struct {
	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"`
}

type ListGitRepositoriesOutput

type ListGitRepositoriesOutput struct {
	Body base.Paginated[gitops.GitRepository]
}

type Module

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

func New

func New(deps Dependencies) *Module

func (*Module) RegisterRoutes

func (m *Module) RegisterRoutes(api huma.API)

func (*Module) Service

func (m *Module) Service() *GitRepositoryService

type SyncGitRepositoriesInput

type SyncGitRepositoriesInput struct {
	Body gitops.RepositorySyncRequest
}

type SyncGitRepositoriesOutput

type SyncGitRepositoriesOutput struct {
	Body base.ApiResponse[base.MessageResponse]
}

type TestGitRepositoryInput

type TestGitRepositoryInput struct {
	ID     string `path:"id" doc:"Repository ID"`
	Branch string `query:"branch" doc:"Branch to test (optional, uses repository default branch when omitted)"`
}

type TestGitRepositoryOutput

type TestGitRepositoryOutput struct {
	Body base.ApiResponse[base.MessageResponse]
}

type UpdateGitRepositoryInput

type UpdateGitRepositoryInput struct {
	ID   string `path:"id" doc:"Repository ID"`
	Body UpdateGitRepositoryRequest
}

type UpdateGitRepositoryOutput

type UpdateGitRepositoryOutput struct {
	Body base.ApiResponse[gitops.GitRepository]
}

type UpdateGitRepositoryRequest added in v2.8.1

type UpdateGitRepositoryRequest struct {
	Name                   *string `json:"name,omitempty"`
	URL                    *string `json:"url,omitempty"`
	AuthType               *string `json:"authType,omitempty" binding:"omitempty,oneof=none http ssh"`
	Username               *string `json:"username,omitempty"`
	Token                  *string `json:"token,omitempty"`
	SSHKey                 *string `json:"sshKey,omitempty"`
	SSHHostKeyVerification *string `json:"sshHostKeyVerification,omitempty" binding:"omitempty,oneof=strict accept_new skip"`
	Description            *string `json:"description,omitempty"`
	Enabled                *bool   `json:"enabled,omitempty"`
}

Jump to

Keyboard shortcuts

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