Documentation ¶
Index ¶
- Constants
- Variables
- func ForFileContentFunc(fs billy.Filesystem, base string, ...) error
- func ForFileNameFunc(fs billy.Filesystem, base string, fun func(filename string) error) error
- type Commit
- type CommitFile
- type CommitMessage
- type Commiter
- type ContentUpdateFunc
- type ContentVistitFunc
- type FileDiff
- type GitHandler
- type GiteaRemote
- type Options
- type Repository
- func (r *Repository) CloneURL() string
- func (r *Repository) CommitPush(ctx context.Context, path string, commit *CommitMessage) error
- func (r *Repository) CommitPushWithRetry(ctx context.Context, path string, commit *CommitMessage) error
- func (r *Repository) ContentFunc(ctx context.Context, path string, fun ContentUpdateFunc) error
- func (r *Repository) Diff(ctx context.Context, path string, hash string) ([]FileDiff, error)
- func (r *Repository) Expired() bool
- func (r *Repository) Filesystem(ctx context.Context, path string) (billy.Filesystem, error)
- func (r *Repository) HistoryFiles(ctx context.Context, path string, rev string) (*Commit, error)
- func (r *Repository) HistoryFunc(ctx context.Context, path string, fun ContentVistitFunc) error
- func (r *Repository) Pull(ctx context.Context) error
- type RepositoryRef
- type RevMeta
- type SimpleLocalProvider
- func (p *SimpleLocalProvider) GenerateCloneURL(ctx context.Context, ref RepositoryRef) string
- func (p *SimpleLocalProvider) Get(ctx context.Context, ref RepositoryRef) (*Repository, error)
- func (p *SimpleLocalProvider) GetRemoteRepoRevMeta(ctx context.Context, repourl string, branchOrRev string) (*RevMeta, error)
- func (p *SimpleLocalProvider) Options() *Options
Constants ¶
View Source
const ( CacheTimeout = 2 * time.Minute DefaultBranch = "_base" )
View Source
const MaxCommitRetry = 3
Variables ¶
View Source
var DefaultCommiter = &Commiter{
Name: "service",
Email: "service@kubgems.io",
}
Functions ¶
func ForFileContentFunc ¶
Types ¶
type CommitFile ¶
type CommitMessage ¶
type ContentUpdateFunc ¶
type GitHandler ¶
type GitHandler = SimpleLocalProvider
type GiteaRemote ¶
func (*GiteaRemote) EnsureRepo ¶
func (h *GiteaRemote) EnsureRepo(ctx context.Context, orgname, reponame string) (*gitea.Repository, error)
type Options ¶
type Options struct { Addr string `json:"addr" description:"git addr"` Username string `json:"username" description:"git username"` Password string `json:"password" description:"git password"` }
func NewDefaultOptions ¶
func NewDefaultOptions() *Options
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func (*Repository) CloneURL ¶
func (r *Repository) CloneURL() string
func (*Repository) CommitPush ¶
func (r *Repository) CommitPush(ctx context.Context, path string, commit *CommitMessage) error
func (*Repository) CommitPushWithRetry ¶
func (r *Repository) CommitPushWithRetry(ctx context.Context, path string, commit *CommitMessage) error
func (*Repository) ContentFunc ¶
func (r *Repository) ContentFunc(ctx context.Context, path string, fun ContentUpdateFunc) error
ContentFunc change fs content and do a commit if commit is not nil
func (*Repository) Expired ¶
func (r *Repository) Expired() bool
func (*Repository) Filesystem ¶
func (r *Repository) Filesystem(ctx context.Context, path string) (billy.Filesystem, error)
func (*Repository) HistoryFiles ¶
func (*Repository) HistoryFunc ¶
func (r *Repository) HistoryFunc(ctx context.Context, path string, fun ContentVistitFunc) error
type RepositoryRef ¶
type SimpleLocalProvider ¶
type SimpleLocalProvider struct {
// contains filtered or unexported fields
}
func NewProvider ¶
func NewProvider(options *Options) (*SimpleLocalProvider, error)
func (*SimpleLocalProvider) GenerateCloneURL ¶
func (p *SimpleLocalProvider) GenerateCloneURL(ctx context.Context, ref RepositoryRef) string
func (*SimpleLocalProvider) Get ¶
func (p *SimpleLocalProvider) Get(ctx context.Context, ref RepositoryRef) (*Repository, error)
func (*SimpleLocalProvider) GetRemoteRepoRevMeta ¶
func (*SimpleLocalProvider) Options ¶
func (p *SimpleLocalProvider) Options() *Options
Click to show internal directories.
Click to hide internal directories.