promote

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ready  = "Ready"
	Draft  = "Draft"
	Cancel = "Cancel"
)

Variables

View Source
var Separator = strings.Repeat("—", 80)

Functions

This section is empty.

Types

type FileSystemYamlWriter

type FileSystemYamlWriter struct{}

func (*FileSystemYamlWriter) Write

func (w *FileSystemYamlWriter) Write(file *yml.File) error

type GitProvider

type GitProvider interface {
	EnsureCleanAndUpToDateWorkingCopy() error
	CreateAndPushBranchWithFiles(branchName string, files []string, message string) error
	CheckoutMasterBranch() error
}

type InteractivePromptProvider

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

func (*InteractivePromptProvider) ConfirmAutoMergePullRequest added in v0.22.0

func (*InteractivePromptProvider) ConfirmAutoMergePullRequest() (answer bool, err error)

func (*InteractivePromptProvider) ConfirmCreatingPromotionPullRequest

func (i *InteractivePromptProvider) ConfirmCreatingPromotionPullRequest(autoMerge, draft bool) (bool, error)

func (*InteractivePromptProvider) PrintBranchCreated

func (i *InteractivePromptProvider) PrintBranchCreated(branchName, message string)

func (*InteractivePromptProvider) PrintCanceled

func (i *InteractivePromptProvider) PrintCanceled()

func (*InteractivePromptProvider) PrintCompleted

func (i *InteractivePromptProvider) PrintCompleted()

func (*InteractivePromptProvider) PrintDraftPullRequestCreated added in v0.26.0

func (i *InteractivePromptProvider) PrintDraftPullRequestCreated(url string)

func (*InteractivePromptProvider) PrintEndPreview

func (i *InteractivePromptProvider) PrintEndPreview()

func (*InteractivePromptProvider) PrintNoPromotableEnvironmentFound

func (i *InteractivePromptProvider) PrintNoPromotableEnvironmentFound(environmentsFiltered bool)

func (*InteractivePromptProvider) PrintNoPromotableReleasesFound

func (i *InteractivePromptProvider) PrintNoPromotableReleasesFound(releasesFiltered bool, sourceEnv *v1alpha1.Environment, targetEnv *v1alpha1.Environment)

func (*InteractivePromptProvider) PrintPullRequestCreated

func (i *InteractivePromptProvider) PrintPullRequestCreated(url string)

func (*InteractivePromptProvider) PrintReleasePreview

func (i *InteractivePromptProvider) PrintReleasePreview(targetEnvName string, releaseName string, existingTargetFile, promotedFile *yml.File) error

func (*InteractivePromptProvider) PrintSelectedReleasesAlreadyInSync

func (i *InteractivePromptProvider) PrintSelectedReleasesAlreadyInSync()

func (*InteractivePromptProvider) PrintStartPreview

func (i *InteractivePromptProvider) PrintStartPreview()

func (*InteractivePromptProvider) PrintUpdatingTargetRelease

func (i *InteractivePromptProvider) PrintUpdatingTargetRelease(targetEnvName, releaseName, releaseFilePath string, isCreating bool)

func (*InteractivePromptProvider) SelectCreatingPromotionPullRequest added in v0.26.0

func (i *InteractivePromptProvider) SelectCreatingPromotionPullRequest() (string, error)

func (*InteractivePromptProvider) SelectReleases

func (i *InteractivePromptProvider) SelectReleases(list *cross.ReleaseList) (*cross.ReleaseList, error)

func (*InteractivePromptProvider) SelectSourceEnvironment

func (i *InteractivePromptProvider) SelectSourceEnvironment(environments []*v1alpha1.Environment) (*v1alpha1.Environment, error)

func (*InteractivePromptProvider) SelectTargetEnvironment

func (i *InteractivePromptProvider) SelectTargetEnvironment(environments []*v1alpha1.Environment) (*v1alpha1.Environment, error)

type Opts

type Opts struct {
	// Catalog contains candidate environments and releases to promote.
	Catalog *catalog.Catalog

	// SourceEnv is the source environment to promote from.
	SourceEnv *v1alpha1.Environment

	// TargetEnv is the target environment to promote to.
	TargetEnv *v1alpha1.Environment

	// Releases are the already selected releases.
	// If there is more than one, no need to prompt the user to select releases.
	Releases []string

	ReleasesFiltered bool

	// NoPrompt means that the Promote function should avoid interactive prompts at all costs.
	NoPrompt bool

	// AutoMerge indicates if PR created needs the auto-merge label
	AutoMerge bool

	// Draft indicates if PR created needs to be draft
	Draft bool

	// SelectedEnvironments is the list of environments selected by the user interactively via `joy env select`.
	SelectedEnvironments []*v1alpha1.Environment
}

type PerformParams added in v0.22.0

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

type Promotion

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

func NewDefaultPromotion

func NewDefaultPromotion(catalogDir string) *Promotion

func NewPromotion

func NewPromotion(prompt PromptProvider, gitProvider GitProvider, pullRequestProvider pr.PullRequestProvider, yamlWriter YamlWriter) *Promotion

func (*Promotion) Promote

func (p *Promotion) Promote(opts Opts) (string, error)

Promote prompts user to select source and target environments and releases to promote and creates a pull request, returning its URL if any.

type PromptProvider

type PromptProvider interface {
	// SelectSourceEnvironment prompts user to select source environment to promote from.
	SelectSourceEnvironment(environments []*v1alpha1.Environment) (*v1alpha1.Environment, error)

	// SelectTargetEnvironment prompts user to select target environment to promote to.
	SelectTargetEnvironment(environments []*v1alpha1.Environment) (*v1alpha1.Environment, error)

	// SelectReleases prompts user to select releases to promote.
	SelectReleases(list *cross.ReleaseList) (*cross.ReleaseList, error)

	// ConfirmCreatingPromotionPullRequest prompts user to confirm whether to continue creating promotion pull request
	// or abort.
	ConfirmCreatingPromotionPullRequest(autoMerge, draft bool) (bool, error)

	// SelectCreatingPromotionPullRequest prompts user to select state of promotion PR
	// or abort.
	SelectCreatingPromotionPullRequest() (string, error)

	// ConfirmAutoMergePullRequest prompts user to confirm whether to auto-merge promotion PR or not
	ConfirmAutoMergePullRequest() (bool, error)

	// PrintNoPromotableReleasesFound prints message that no promotable releases were found for given
	// source and target environments or potentially none because release filtering was applied.
	PrintNoPromotableReleasesFound(releasesFiltered bool, sourceEnv *v1alpha1.Environment, targetEnv *v1alpha1.Environment)

	// PrintNoPromotableEnvironmentFound prints message that no promotable environments were found
	// or potentially none because environment filtering was applied.
	PrintNoPromotableEnvironmentFound(environmentsFiltered bool)

	// PrintStartPreview starts the preview of release promotion diffs.
	PrintStartPreview()

	// PrintReleasePreview prints the diff for promotion of a given release.
	PrintReleasePreview(targetEnvName string, releaseName string, existingTargetFile, promotedFile *yml.File) error

	// PrintEndPreview ends the preview of release promotion diffs.
	PrintEndPreview()

	// PrintUpdatingTargetRelease prints message that target release file is being updated or created.
	PrintUpdatingTargetRelease(targetEnvName, releaseName, releaseFilePath string, isCreating bool)

	// PrintBranchCreated prints message that a new promotion branch was created and promotion changes were committed
	// and pushed.
	PrintBranchCreated(branchName, message string)

	// PrintDraftPullRequestCreated prints message that a new promotion draft pull request was created.
	PrintDraftPullRequestCreated(url string)

	// PrintPullRequestCreated prints message that a new promotion pull request was created.
	PrintPullRequestCreated(url string)

	// PrintCanceled prints message that promotion was canceled and no pull request was created.
	PrintCanceled()

	// PrintCompleted prints message that the whole promotion operation was completed.
	PrintCompleted()
}

type ShellGitProvider

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

func NewShellGitProvider

func NewShellGitProvider(dir string) *ShellGitProvider

func (*ShellGitProvider) CheckoutMasterBranch

func (g *ShellGitProvider) CheckoutMasterBranch() error

func (*ShellGitProvider) CreateAndPushBranchWithFiles

func (g *ShellGitProvider) CreateAndPushBranchWithFiles(branchName string, files []string, message string) error

func (*ShellGitProvider) EnsureCleanAndUpToDateWorkingCopy

func (g *ShellGitProvider) EnsureCleanAndUpToDateWorkingCopy() error

type YamlWriter

type YamlWriter interface {
	Write(file *yml.File) error
}

Jump to

Keyboard shortcuts

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