Documentation
¶
Overview ¶
Git Repository Adapter
This component implements integration of git into package orchestration. A local clone of a registered git repository is created in a cache, and periodically refreshed. All package operations happen on the local copy; on completion of an operation (create, update, delete package revision or its resources) any new changes (in one or more commits) are pushed to the remote repository.
Branching Strategy ¶
Porch doesn't create tracking branches for remotes. This indirection would add a layer of complexity where branches can become out of sync and in need of reconciliation and conflict resolution. Instead, Porch analyzes the remote references (refs/remotes/origin/branch...) to discover packages. These refs are never directly updated by Porch other than by push or fetch to/from remote. Any intermediate commits Porch makes are either in 'detached HEAD' mode, or using temporary branches (these will become relevant if/when Porch implements repository garbage collection).
Porch uses the default convention for naming remote branches (refs/remotes/origin/branch...) in order to make direct introspection of the repositories aligned with traditional git repositories.
Index ¶
- func AppendRetryableErrors(patterns []string)
- type GitRepoFactory
- func (f *GitRepoFactory) CheckRepositoryConnection(ctx context.Context, repositorySpec *configapi.Repository, ...) error
- func (f *GitRepoFactory) NewRepositoryImpl(ctx context.Context, repositorySpec *configapi.Repository, ...) (repository.Repository, error)
- func (f *GitRepoFactory) ValidateRepositoryHistory(ctx context.Context, repositorySpec *configapi.Repository, ...) error
- type GitRepository
- type GitRepositoryOptions
- type MainBranchStrategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendRetryableErrors ¶
func AppendRetryableErrors(patterns []string)
AppendRetryableErrors adds additional error patterns to the retryable errors list. Patterns can be specified multiple times or as comma-separated values.
Types ¶
type GitRepoFactory ¶
type GitRepoFactory struct {
}
func (*GitRepoFactory) CheckRepositoryConnection ¶
func (f *GitRepoFactory) CheckRepositoryConnection(ctx context.Context, repositorySpec *configapi.Repository, options externalrepotypes.ExternalRepoOptions) error
func (*GitRepoFactory) NewRepositoryImpl ¶
func (f *GitRepoFactory) NewRepositoryImpl(ctx context.Context, repositorySpec *configapi.Repository, options externalrepotypes.ExternalRepoOptions) (repository.Repository, error)
func (*GitRepoFactory) ValidateRepositoryHistory ¶
func (f *GitRepoFactory) ValidateRepositoryHistory(ctx context.Context, repositorySpec *configapi.Repository, options externalrepotypes.ExternalRepoOptions) error
ValidateRepositoryHistory rejects a rehome to a divergent repo: the recorded status.gitCommitHash must still be reachable from the configured branch HEAD (not necessarily equal — the branch moves forward between syncs). Skipped when no hash is recorded yet. Separate from CheckRepositoryConnection because it may fetch branch history, so it runs on full sync only, not health checks.
type GitRepository ¶
type GitRepository interface {
repository.Repository
GetPackageRevision(ctx context.Context, ref, path string) (repository.PackageRevision, kptfilev1.GitLock, error)
UpdateDeletionProposedCache(ctx context.Context) error
}
func OpenRepository ¶
func OpenRepository(ctx context.Context, name, namespace string, spec *configapi.GitRepository, deployment bool, root string, opts GitRepositoryOptions) (GitRepository, error)
type GitRepositoryOptions ¶
type GitRepositoryOptions struct {
externalrepotypes.ExternalRepoOptions
MainBranchStrategy MainBranchStrategy
}
type MainBranchStrategy ¶
type MainBranchStrategy int
const ( ErrorIfMissing MainBranchStrategy = iota // ErrorIsMissing CreateIfMissing // CreateIfMissing SkipVerification // SkipVerification )
func (MainBranchStrategy) String ¶
func (i MainBranchStrategy) String() string