git

package
v0.0.1-prerelease7 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var (
	// ErrProposalNotFound is returned when a proposal cannot be located
	ErrProposalNotFound = errors.New("proposal not found")
)

Functions

func ProposeChanges

func ProposeChanges[A Resource](opts ProposalOption) containers.Option[Phase[A]]

ProposeChanges configures the phase to propose the change (via PR or MR) as opposed to directly integrating it into the target trunk branch.

Types

type Branched

type Branched interface {
	Branch(phase core.Descriptor) string
}

type Phase

type Phase[R Resource] struct {
	// contains filtered or unexported fields
}

func NewPhase

func NewPhase[R Resource](
	pipeline string,
	meta core.Metadata,
	newFn func() R,
	repo *git.Repository,
	proposer Proposer,
	opts ...containers.Option[Phase[R]],
) (_ *Phase[R])

func (*Phase[R]) Branches

func (p *Phase[R]) Branches() []string

func (*Phase[A]) Descriptor

func (p *Phase[A]) Descriptor() core.Descriptor

func (*Phase[R]) Get

func (p *Phase[R]) Get(ctx context.Context) (core.Resource, error)

func (*Phase[R]) GetResource

func (p *Phase[R]) GetResource(ctx context.Context) (R, error)

func (*Phase[R]) History

func (p *Phase[R]) History(ctx context.Context) ([]core.State, error)

func (*Phase[R]) Notify

func (p *Phase[R]) Notify(ctx context.Context, refs map[string]string) error

func (*Phase[R]) Update

func (p *Phase[R]) Update(ctx context.Context, to R) (map[string]string, error)

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
}

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
}

type RefLog

type RefLog[R core.Resource] interface {
	CreateReference(ctx context.Context, phase core.Descriptor) error
	RecordLatest(ctx context.Context, phase core.Descriptor, resource R, annotations map[string]string) error
	History(ctx context.Context, phase core.Descriptor) ([]core.State, error)
}

type Resource

type Resource interface {
	core.Resource
	ReadFrom(context.Context, core.Descriptor, fs.Filesystem) error
	WriteTo(context.Context, core.Descriptor, fs.Filesystem) error
}

Jump to

Keyboard shortcuts

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