Documentation
¶
Index ¶
- Constants
- Variables
- func ProposeChanges[R Resource](opts ProposalOption) containers.Option[Phase[R]]
- func WithLogger[R Resource](log typed.PhaseLogger[R]) containers.Option[Phase[R]]
- type Branched
- type Phase
- func (p *Phase[R]) Branches() []string
- func (p *Phase[A]) Descriptor() core.Descriptor
- func (p *Phase[R]) Get(ctx context.Context) (core.Resource, error)
- func (p *Phase[R]) GetResource(ctx context.Context) (R, error)
- func (p *Phase[R]) History(ctx context.Context) ([]core.State, error)
- func (p *Phase[R]) Notify(ctx context.Context, refs map[string]string) error
- func (p *Phase[R]) Rollback(ctx context.Context, version uuid.UUID) (*core.Result, error)
- func (p *Phase[R]) Update(ctx context.Context, to R, opts ...containers.Option[typed.UpdateOptions]) (*core.Result, error)
- type Proposal
- type ProposalOption
- type Proposer
- type Resource
Constants ¶
const ( AnnotationGitBaseRefKey = "dev.getglu.git.base_ref" AnnotationGitHeadSHAKey = "dev.getglu.git.head_sha" AnnotationProposalNumberKey = "dev.getglu.git.proposal.number" AnnotationProposalURLKey = "dev.getglu.git.proposal.url" )
Variables ¶
var ( // ErrProposalNotFound is returned when a proposal cannot be located ErrProposalNotFound = errors.New("proposal not found") )
Functions ¶
func ProposeChanges ¶
func ProposeChanges[R Resource](opts ProposalOption) containers.Option[Phase[R]]
ProposeChanges configures the phase to propose the change (via PR or MR) as opposed to directly integrating it into the target trunk branch.
func WithLogger ¶
func WithLogger[R Resource](log typed.PhaseLogger[R]) containers.Option[Phase[R]]
WithLogger sets of the reflog on the phase for tracking history
Types ¶
type Branched ¶
type Branched interface {
Branch(phase core.Descriptor) string
}
Branched is a resource which exposes an alternative base branch on which the resource should be based.
type Phase ¶
type Phase[R Resource] struct { // contains filtered or unexported fields }
Phase is a Git storage backed phase implementation. It is used to manage the state of a resource as represented in a target Git repository.
func New ¶
func New[R Resource]( ctx context.Context, pipeline string, meta core.Metadata, newFn func() R, repo *git.Repository, proposer Proposer, opts ...containers.Option[Phase[R]], ) (*Phase[R], error)
New constructs and configures a new phase.
func (*Phase[A]) Descriptor ¶
func (p *Phase[A]) Descriptor() core.Descriptor
Descriptor returns the phases descriptor.
func (*Phase[R]) History ¶
History returns the history of the phase (given a log has been configured).
type Proposal ¶
type Proposal struct {
BaseRevision string
BaseBranch string
Branch string
HeadRevision string
Digest string
Title string
Body string
Annotations map[string]string
}
Proposal contains the fields necessary to propose a resource update to a Repository.
type ProposalOption ¶
type ProposalOption struct {
Labels []string
}
ProposalOption configures calls to create proposals
type Proposer ¶
type Proposer interface {
GetCurrentProposal(_ context.Context, baseBranch, branchPrefix string) (*Proposal, error)
CreateProposal(context.Context, *Proposal, ProposalOption) error
MergeProposal(context.Context, *Proposal) error
CloseProposal(context.Context, *Proposal) error
}
Proposer is a type which can be used to create and manage proposals.
type Resource ¶
type Resource interface {
core.Resource
ReadFrom(context.Context, core.Descriptor, fs.Filesystem) error
WriteTo(context.Context, core.Descriptor, fs.Filesystem) error
}
Resource is a core.Resource with additional constraints which are required for reading from and writing to a filesystem.