Documentation ¶
Index ¶
- Variables
- func WithPushResultRefspec(refspecs []string) func(*PushResult)
- func WithPushResultSwitchBranch() func(*PushResult)
- type CheckoutOption
- type PushConfig
- type PushResult
- type PushResultOption
- type SourceManager
- func (sm *SourceManager) CheckoutSource(ctx context.Context, options ...CheckoutOption) (*git.Commit, error)
- func (sm SourceManager) Cleanup() error
- func (sm SourceManager) CommitAndPush(ctx context.Context, obj *imagev1.ImageUpdateAutomation, ...) (*PushResult, error)
- func (sm SourceManager) SwitchBranch() bool
- func (sm SourceManager) WorkDirectory() string
- type SourceOption
- type SourceOptions
- type TemplateData
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidSourceConfiguration = errors.New("invalid source configuration")
ErrInvalidSourceConfiguration is an error for invalid source configuration.
Functions ¶
func WithPushResultRefspec ¶
func WithPushResultRefspec(refspecs []string) func(*PushResult)
WithPushResultRefspec sets the refspecs in the PushResult.
func WithPushResultSwitchBranch ¶
func WithPushResultSwitchBranch() func(*PushResult)
WithPushResultSwitchBranch marks the PushResult with switchBranch.
Types ¶
type CheckoutOption ¶
type CheckoutOption func(*repository.CloneConfig)
CheckoutOption allows configuring the checkout options.
func WithCheckoutOptionLastObserved ¶
func WithCheckoutOptionLastObserved(commit string) CheckoutOption
WithCheckoutOptionLastObserved is a CheckoutOption option to configure the last observed commit.
func WithCheckoutOptionShallowClone ¶
func WithCheckoutOptionShallowClone() CheckoutOption
WithCheckoutOptionShallowClone is a CheckoutOption option to configure shallow clone.
type PushConfig ¶
type PushConfig func(*repository.PushConfig)
PushConfig configures the options used in push operation.
func WithPushConfigForce ¶
func WithPushConfigForce() PushConfig
WithPushConfigForce configures the PushConfig to use force.
func WithPushConfigOptions ¶
func WithPushConfigOptions(opts map[string]string) PushConfig
WithPushConfigOptions configures the PushConfig Options that are used in push.
type PushResult ¶
type PushResult struct {
// contains filtered or unexported fields
}
PushResult is the result of a push operation.
func NewPushResult ¶
func NewPushResult(branch string, rev string, commitMsg string, opts ...PushResultOption) (*PushResult, error)
NewPushResult returns a new PushResult.
func (PushResult) Commit ¶
func (pr PushResult) Commit() *git.Commit
Commit returns the revision of the pushed commit.
func (PushResult) Summary ¶
func (pr PushResult) Summary() string
Summary returns a summary of the PushResult.
func (PushResult) SwitchBranch ¶
func (pr PushResult) SwitchBranch() bool
SwitchBranch returns if the source has different checkout and push branch.
func (PushResult) Time ¶
func (pr PushResult) Time() *metav1.Time
Time returns the time at which the push was performed.
type PushResultOption ¶
type PushResultOption func(*PushResult)
PushResultOption allows configuring the options of PushResult.
type SourceManager ¶
type SourceManager struct {
// contains filtered or unexported fields
}
SourceManager manages source.
func NewSourceManager ¶
func NewSourceManager(ctx context.Context, c client.Client, obj *imagev1.ImageUpdateAutomation, options ...SourceOption) (*SourceManager, error)
NewSourceManager takes all the provided inputs, validates them and returns a SourceManager which can be used to operate on the configured source.
func (*SourceManager) CheckoutSource ¶
func (sm *SourceManager) CheckoutSource(ctx context.Context, options ...CheckoutOption) (*git.Commit, error)
CheckoutSource clones and checks out the source. If a push branch is configured that doesn't match with the checkout branch, a checkout to the push branch is also performed. This ensures any change and push operation following the checkout happens on the push branch.
func (SourceManager) Cleanup ¶
func (sm SourceManager) Cleanup() error
Cleanup deletes the working directory of the SourceManager.
func (SourceManager) CommitAndPush ¶
func (sm SourceManager) CommitAndPush(ctx context.Context, obj *imagev1.ImageUpdateAutomation, policyResult update.ResultV2, pushOptions ...PushConfig) (*PushResult, error)
CommitAndPush performs a commit in the source and pushes it to the remote repository.
func (SourceManager) SwitchBranch ¶
func (sm SourceManager) SwitchBranch() bool
SwitchBranch returns if the checkout branch and push branch are different.
func (SourceManager) WorkDirectory ¶
func (sm SourceManager) WorkDirectory() string
CreateWorkingDirectory creates a working directory for the SourceManager.
type SourceOption ¶
type SourceOption func(*SourceOptions)
SourceOption configures the SourceManager options.
func WithSourceOptionGitAllBranchReferences ¶
func WithSourceOptionGitAllBranchReferences() SourceOption
WithSourceOptionGitAllBranchReferences configures the SourceManager to fetch all the Git branch references that are present in the remote repository.
func WithSourceOptionNoCrossNamespaceRef ¶
func WithSourceOptionNoCrossNamespaceRef() SourceOption
WithSourceOptionNoCrossNamespaceRef configures the SourceManager to disable cross namespace references.
type SourceOptions ¶
type SourceOptions struct {
// contains filtered or unexported fields
}
SourceOptions contains the optional attributes of SourceManager.
type TemplateData ¶
type TemplateData struct { AutomationObject types.NamespacedName Updated update.Result Changed update.ResultV2 }
TemplateData is the type of the value given to the commit message template.