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

gitrepo

package
v2.17.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: BSD-3-Clause Imports: 25 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 CreateGitRepositoryInput

type CreateGitRepositoryInput struct {
	Body gitops.CreateRepositoryRequest
}

type DeleteGitRepositoryInput

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

type GetGitRepositoryInput

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

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
	CommitAuthorName       string  `json:"commitAuthorName" gorm:"column:commit_author_name"`
	CommitAuthorEmail      string  `json:"commitAuthorEmail" gorm:"column:commit_author_email"`
	SigningKey             string  `json:"signingKey" gorm:"column:signing_key"`                      // encrypted
	SigningKeyPassphrase   string  `json:"signingKeyPassphrase" gorm:"column:signing_key_passphrase"` // encrypted
	Description            *string `json:"description,omitempty" sortable:"true"`
	Enabled                bool    `json:"enabled" sortable:"true" search:"enabled,active,disabled"`
}

func (GitRepository) HasSigningKey added in v2.12.0

func (r GitRepository) HasSigningKey() bool

HasSigningKey reports whether an OpenPGP signing key is stored.

func (GitRepository) HasSshKey added in v2.11.0

func (r GitRepository) HasSshKey() bool

HasSshKey reports whether an SSH private key is stored.

func (GitRepository) HasToken added in v2.11.0

func (r GitRepository) HasToken() bool

HasToken reports whether an HTTP token is stored.

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 user.Actor) 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) GetCommitIdentity added in v2.12.0

func (s *GitRepositoryService) GetCommitIdentity(ctx context.Context, repository *GitRepository) (git.CommitIdentity, error)

GetCommitIdentity returns the author for commits Arcane pushes to the repository, with the signing key unlocked when one is stored.

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, branch string, actor user.Actor) error

func (*GitRepositoryService) UpdateRepository

type ListBranchesInput

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

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 Module

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

func New

func New(service *GitRepositoryService) *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 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 UpdateGitRepositoryInput

type UpdateGitRepositoryInput struct {
	ID   string `path:"id" doc:"Repository ID"`
	Body gitops.UpdateRepositoryRequest
}

Jump to

Keyboard shortcuts

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