promote

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchProvider

type BranchProvider interface {
	// GetCurrentBranch returns name of branch currently checked out in current working directory.
	GetCurrentBranch() (string, error)
}

type GitBranchProvider

type GitBranchProvider struct {
	// contains filtered or unexported fields
}

func NewGitBranchProvider

func NewGitBranchProvider(dir string) *GitBranchProvider

func (*GitBranchProvider) GetCurrentBranch

func (g *GitBranchProvider) GetCurrentBranch() (string, error)

type InteractivePromptProvider

type InteractivePromptProvider struct{}

func (*InteractivePromptProvider) ConfirmDisablingPromotionOnOtherPullRequest

func (s *InteractivePromptProvider) ConfirmDisablingPromotionOnOtherPullRequest(branch, env string) (bool, error)

func (*InteractivePromptProvider) PrintBranchDoesNotSupportAutoPromotion

func (s *InteractivePromptProvider) PrintBranchDoesNotSupportAutoPromotion(branch string)

func (*InteractivePromptProvider) PrintNotCreatingPullRequest

func (s *InteractivePromptProvider) PrintNotCreatingPullRequest()

func (*InteractivePromptProvider) PrintPromotionAlreadyConfigured

func (s *InteractivePromptProvider) PrintPromotionAlreadyConfigured(branch, env string)

func (*InteractivePromptProvider) PrintPromotionConfigured

func (s *InteractivePromptProvider) PrintPromotionConfigured(branch string, env string)

func (*InteractivePromptProvider) PrintPromotionDisabled

func (s *InteractivePromptProvider) PrintPromotionDisabled(branch string)

func (*InteractivePromptProvider) PrintPromotionNotConfigured

func (s *InteractivePromptProvider) PrintPromotionNotConfigured(branch string, env string)

func (*InteractivePromptProvider) WhetherToCreateMissingPullRequest

func (s *InteractivePromptProvider) WhetherToCreateMissingPullRequest() (bool, error)

func (*InteractivePromptProvider) WhichEnvironmentToPromoteTo

func (s *InteractivePromptProvider) WhichEnvironmentToPromoteTo(environments []string, preSelectedEnv string) (string, error)

type Promotion

type Promotion struct {
	// contains filtered or unexported fields
}

func NewDefaultPromotion

func NewDefaultPromotion(dir string) *Promotion

func NewPromotion

func NewPromotion(branchProvider BranchProvider, pullRequestProvider pr.PullRequestProvider, prompt PromptProvider) *Promotion

func (*Promotion) Promote

func (p *Promotion) Promote(environments []*v1alpha1.Environment) error

Promote prompts user to create a pull request for current branch and to select environment to auto-promote builds of pull request to, and then configures the pull request accordingly.

type PromptProvider

type PromptProvider interface {
	// WhetherToCreateMissingPullRequest prompts user to create a pull request for current branch.
	WhetherToCreateMissingPullRequest() (bool, error)

	// WhichEnvironmentToPromoteTo prompts user to select environment to auto-promote builds of pull request to.
	// If empty string is returned, user opted to disable auto-promotion.
	WhichEnvironmentToPromoteTo(environments []string, preSelectedEnv string) (string, error)

	// ConfirmDisablingPromotionOnOtherPullRequest prompts user to confirm it is ok to disable auto-promotion of another
	// pull request having same target environment.
	ConfirmDisablingPromotionOnOtherPullRequest(branch, env string) (bool, error)

	// PrintBranchDoesNotSupportAutoPromotion prints message that master/main branch cannot be promoted.
	PrintBranchDoesNotSupportAutoPromotion(branch string)

	// PrintNotCreatingPullRequest prints message that user opted not to create pull request.
	PrintNotCreatingPullRequest()

	// PrintPromotionAlreadyConfigured prints message that given branch is configured for auto-promotion to given
	// environment.
	PrintPromotionAlreadyConfigured(branch, env string)

	// PrintPromotionNotConfigured prints message that promotion was not configured.
	PrintPromotionNotConfigured(branch, env string)

	// PrintPromotionConfigured prints message that promotion was correctly configured.
	PrintPromotionConfigured(branch, env string)

	// PrintPromotionDisabled prints message that promotion was disabled.
	PrintPromotionDisabled(branch string)
}

Jump to

Keyboard shortcuts

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