lifecycle

package
v1.3.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractBranchVersion added in v0.8.1

func ExtractBranchVersion(branch string) string

ExtractBranchVersion will extract the branch version from the branch name

Types

type Asset

type Asset struct {
	Version string
	// contains filtered or unexported fields
}

Asset represents an asset with its version and path in the repository

type Dependencies

type Dependencies struct {
	RootFs            billy.Filesystem
	AssetsVersionsMap map[string][]Asset
	VR                *VersionRules
	Git               *git.Git
	// contains filtered or unexported fields
}

Dependencies holds the necessary filesystem, assets versions map, version rules and methods to apply the lifecycle rules in the target branch

func InitDependencies

func InitDependencies(rootFs billy.Filesystem, branchVersion string, currentChart string) (*Dependencies, error)

InitDependencies will check the filesystem, branch version, git status, initialize the Dependencies struct and populate it. If anything fails the operation will be aborted.

func (*Dependencies) CheckLifecycleStatusAndSave added in v0.9.0

func (ld *Dependencies) CheckLifecycleStatusAndSave(chart string) (*Status, error)

CheckLifecycleStatusAndSave checks the lifecycle status of the assets at 3 different levels prints to the console and saves to log files at 'logs/' folder.

type Logs added in v0.9.3

type Logs struct {
	File     *os.File
	FilePath string
}

Logs is a struct that holds the file and file path of the log file

func CreateLogs added in v0.9.3

func CreateLogs(fileName, detail string) (*Logs, error)

CreateLogs creates a new log file and returns a logs struct with the file and file path

func (*Logs) Write added in v0.9.3

func (l *Logs) Write(data string, logType string)

Write writes the data to the log file and prints it to the console with customizations.

func (*Logs) WriteHEAD added in v0.9.3

func (l *Logs) WriteHEAD(versionRules *VersionRules, title string)

WriteHEAD writes the header of the log file with the version rules, dates and necessary information to help analyze the current situation on the charts versions regarding the release process.

func (*Logs) WriteVersions added in v0.9.3

func (l *Logs) WriteVersions(assetsVersions map[string][]Asset, logType string)

WriteVersions receives the loaded assets versions map and writes it to the log file in human-readable format

type Status added in v0.9.0

type Status struct {
	StateFile                       string             `json:"state_file"`
	AssetsInLifecycleCurrentBranch  map[string][]Asset `json:"in_lifecycle_current_branch"`
	AssetsOutLifecycleCurrentBranch map[string][]Asset `json:"out_lifecycle_current_branch"`
	AssetsReleasedInLifecycle       map[string][]Asset `json:"released_in_lifecycle"`      // OK if not empty
	AssetsNotReleasedOutLifecycle   map[string][]Asset `json:"not_released_out_lifecycle"` // OK if not empty
	AssetsNotReleasedInLifecycle    map[string][]Asset `json:"not_released_in_lifecycle"`  // WARN if not empty
	AssetsReleasedOutLifecycle      map[string][]Asset `json:"released_out_lifecycle"`     // ERROR if not empty
	AssetsToBeReleased              map[string][]Asset `json:"to_be_released"`
	AssetsToBeForwardPorted         map[string][]Asset `json:"to_be_forward_ported"`
	// contains filtered or unexported fields
}

Status struct hold the results of the assets versions comparison, this data will all be logged and saves into log files for further analysis

func LoadState added in v0.9.6

func LoadState(rootFs billy.Filesystem) (*Status, error)

LoadState will load the lifecycle-status state from an existing state.json file at charts repo

func (*Status) SaveState added in v0.9.6

func (s *Status) SaveState() error

SaveState will save the lifecycle-status state to state.json file at charts repo

type Version added in v0.9.9

type Version struct {
	Min string `json:"min"`
	Max string `json:"max"`
}

Version holds the maximum and minimum limits allowed for a specific branch version

type VersionRules

type VersionRules struct {
	Rules            map[string]Version `json:"rules"`
	BranchVersion    string             `json:"branch-version,omitempty"`
	MinVersion       int                `json:"min-version,omitempty"`
	MaxVersion       int                `json:"max-version,omitempty"`
	DevBranch        string             `json:"dev-branch,omitempty"`
	DevBranchPrefix  string             `json:"dev-branch-prefix"`
	ProdBranch       string             `json:"prod-branch,omitempty"`
	ProdBranchPrefix string             `json:"prod-branch-prefix"`
}

VersionRules will hold all the necessary information to check which assets versions are allowed to be in the repository

func (*VersionRules) CheckChartVersionForLifecycle added in v0.8.1

func (v *VersionRules) CheckChartVersionForLifecycle(chartVersion string) bool

CheckChartVersionForLifecycle will Check if the chart version is within the range of the current version:

If the chart version is within the range, return true, otherwise return false

func (*VersionRules) CheckChartVersionToRelease added in v0.9.0

func (v *VersionRules) CheckChartVersionToRelease(chartVersion string) (bool, error)

CheckChartVersionToRelease will return if the current versyion being analyzed is the one to be released or not

func (*VersionRules) CheckForRCVersion added in v0.9.4

func (v *VersionRules) CheckForRCVersion(chartVersion string) bool

CheckForRCVersion checks if the chart version contains the "-rc" string indicating a release candidate version.

type WalkDirFunc

type WalkDirFunc func(fs billy.Filesystem, dirPath string, doFunc filesystem.RelativePathFunc) error

WalkDirFunc is a function type that will be used to walk through the filesystem

Jump to

Keyboard shortcuts

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