lifecycle

package
v0.9.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DevBranchPrefix = "dev-v"

DevBranchPrefix is the official prefix for the development branch

View Source
const ProductionBranchPrefix = "prod-v"

ProductionBranchPrefix is the official prefix for the production branch

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 AddAndCommitFunc added in v0.9.3

type AddAndCommitFunc func(message string) error

AddAndCommitFunc is a function type that will be used to add and commit changes in the git tree

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 {
	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, debug bool) (*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) ApplyRules

func (ld *Dependencies) ApplyRules(currentChart string, debug bool) error

ApplyRules will populate all assets versions and paths, sort the versions, and execute make remove for each chart and version. After each chart removal, it will commit the changes in a single commit for all versions of that chart.

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 MakeRemoveFunc

type MakeRemoveFunc func(chart, version string, debug bool) error

MakeRemoveFunc is a function type that will be used to execute make remove

type Status added in v0.9.0

type Status struct {
	AssetsToBeForwardPorted map[string][]Asset
	// 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

type StatusPorcelainFunc added in v0.9.3

type StatusPorcelainFunc func(debug bool) (bool, error)

StatusPorcelainFunc is a function type that will be used to check if the git tree is clean

type VersionRules

type VersionRules struct {
	Rules         map[float32]version
	BranchVersion float32
	MinVersion    int
	MaxVersion    int
	DevBranch     string
	ProdBranch    string
}

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

func GetVersionRules

func GetVersionRules(branchVersion string, debug bool) (*VersionRules, error)

GetVersionRules will check and convert the provided branch version, create the hard-coded rules for the charts repository and calculate the minimum and maximum versions according to the branch version.

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