Documentation ¶
Index ¶
- type AccountValidator
- type Chart
- type ChartUtils
- type DirectoryLister
- type Git
- type Helm
- type Kubectl
- type Linter
- type TestResult
- type TestResults
- type Testing
- func (t *Testing) CheckVersionIncrement(chart *Chart) error
- func (t *Testing) ComputeChangedChartDirectories() ([]string, error)
- func (t *Testing) FindChartDirsToBeProcessed() ([]string, error)
- func (t *Testing) GetOldChartVersion(chartPath string) (string, error)
- func (t *Testing) InstallChart(chart *Chart) TestResult
- func (t *Testing) InstallCharts() ([]TestResult, error)
- func (t *Testing) LintAndInstallChart(chart *Chart) TestResult
- func (t *Testing) LintAndInstallCharts() ([]TestResult, error)
- func (t *Testing) LintChart(chart *Chart) TestResult
- func (t *Testing) LintCharts() ([]TestResult, error)
- func (t *Testing) PrintEventsPodDetailsAndLogs(namespace string, selector string)
- func (t *Testing) PrintResults(results []TestResult)
- func (t *Testing) ReadAllChartDirectories() ([]string, error)
- func (t *Testing) UpgradeChart(chart *Chart) TestResult
- func (t *Testing) ValidateMaintainers(chart *Chart) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountValidator ¶
AccountValidator is the interface that wraps Git account validation
Validate checks if account is valid on repoDomain
type Chart ¶
type Chart struct {
// contains filtered or unexported fields
}
Chart represents a Helm chart, and can be initalized with the NewChart method.
func NewChart ¶
NewChart parses the path to a chart directory and allocates a new Chart object. If chartPath is not a valid chart directory an error is returned.
func (*Chart) CreateInstallParams ¶
CreateInstallParams generates a randomized release name and namespace based on the chart path and optional buildID. If a buildID is specified, it will be part of the generated namespace.
func (*Chart) HasCIValuesFile ¶
HasCIValuesFile checks whether a given CI values file is present.
func (*Chart) ValuesFilePathsForCI ¶
ValuesFilePathsForCI returns all file paths in the 'ci' subfolder of the chart directory matching the pattern '*-values.yaml'
type ChartUtils ¶
ChartUtils is the interface that wraps chart-related methods
LookupChartDir looks up the chart's root directory based on some chart file that has changed
type DirectoryLister ¶
type DirectoryLister interface {
ListChildDirs(parentDir string, test func(string) bool) ([]string, error)
}
DirectoryLister is the interface
ListChildDirs lists direct child directories of parentDir given they pass the test function
type Git ¶
type Git interface { FileExistsOnBranch(file string, remote string, branch string) bool Show(file string, remote string, branch string) (string, error) AddWorktree(path string, ref string) error RemoveWorktree(path string) error MergeBase(commit1 string, commit2 string) (string, error) ListChangedFilesInDirs(commit string, dirs ...string) ([]string, error) GetUrlForRemote(remote string) (string, error) ValidateRepository() error }
Git is the Interface that wraps Git operations.
FileExistsOnBranch checks whether file exists on the specified remote/branch.
Show returns the contents of file on the specified remote/branch.
AddWorktree checks out the contents of the repository at a commit ref into the specified path.
RemoveWorktree removes the working tree at the specified path.
MergeBase returns the SHA1 of the merge base of commit1 and commit2.
ListChangedFilesInDirs diffs commit against HEAD and returns changed files for the specified dirs.
GetUrlForRemote returns the repo URL for the specified remote.
ValidateRepository checks that the current working directory is a valid git repository, and returns nil if valid.
type Helm ¶
type Helm interface { Init() error AddRepo(name string, url string, extraArgs []string) error BuildDependencies(chart string) error LintWithValues(chart string, valuesFile string) error InstallWithValues(chart string, valuesFile string, namespace string, release string) error Upgrade(chart string, release string) error Test(release string, cleanup bool) error DeleteRelease(release string) }
Helm is the interface that wraps Helm operations
Init runs client-side Helm initialization ¶
AddRepo adds a chart repository to the local Helm configuration ¶
BuildDependencies builds the chart's dependencies ¶
LintWithValues runs `helm lint` for the given chart using the specified values file. Pass a zero value for valuesFile in order to run lint without specifying a values file.
InstallWithValues runs `helm install` for the given chart using the specified values file. Pass a zero value for valuesFile in order to run install without specifying a values file.
Upgrade runs `helm upgrade` against an existing release, and re-uses the previously computed values.
Test runs `helm test` against an existing release. Set the cleanup argument to true in order to clean up test pods created by helm after the test command completes.
DeleteRelease purges the specified Helm release.
type Kubectl ¶
type Kubectl interface { DeleteNamespace(namespace string) WaitForDeployments(namespace string, selector string) error GetPodsforDeployment(namespace string, deployment string) ([]string, error) GetPods(args ...string) ([]string, error) GetEvents(namespace string) error DescribePod(namespace string, pod string) error Logs(namespace string, pod string, container string) error GetInitContainers(namespace string, pod string) ([]string, error) GetContainers(namespace string, pod string) ([]string, error) }
Kubectl is the interface that wraps kubectl operations
DeleteNamespace deletes a namespace ¶
WaitForDeployments waits for a deployment to become ready ¶
GetPodsforDeployment gets all pods for a deployment ¶
GetPods gets pods for the given args ¶
GetEvents prints all events for namespace ¶
DescribePod prints the pod's description ¶
Logs prints the logs of container ¶
GetInitContainers gets all init containers of pod ¶
GetContainers gets all containers of pod
type Linter ¶
type Linter interface { YamlLint(yamlFile string, configFile string) error Yamale(yamlFile string, schemaFile string) error }
Linter is the interface that wrap linting operations
YamlLint runs `yamllint` on the specified file with the specified configuration ¶
Yamale runs `yamale` on the specified file with the specified schema file
type TestResult ¶
TestResult holds test results for a specific chart
type TestResults ¶
type TestResults struct { OverallSuccess bool TestResults []TestResult }
TestResults holds results and overall status
type Testing ¶
type Testing struct {
// contains filtered or unexported fields
}
func NewTesting ¶
func NewTesting(config config.Configuration) Testing
NewTesting creates a new Testing struct with the given config.
func (*Testing) CheckVersionIncrement ¶
CheckVersionIncrement checks that the new chart version is greater than the old one using semantic version comparison.
func (*Testing) ComputeChangedChartDirectories ¶
ComputeChangedChartDirectories takes the merge base of HEAD and the configured remote and target branch and computes a slice of changed charts from that in the configured chart directories excluding those configured to be excluded.
func (*Testing) FindChartDirsToBeProcessed ¶
FindChartDirsToBeProcessed identifies charts to be processed depending on the configuration (changed charts, all charts, or specific charts).
func (*Testing) GetOldChartVersion ¶
GetOldChartVersion gets the version of the old Chart.yaml file from the target branch.
func (*Testing) InstallChart ¶
func (t *Testing) InstallChart(chart *Chart) TestResult
InstallChart installs the specified chart into a new namespace, waits for resources to become ready, and eventually uninstalls it and deletes the namespace again.
func (*Testing) InstallCharts ¶
func (t *Testing) InstallCharts() ([]TestResult, error)
InstallCharts install charts (changed, all, specific) depending on the configuration.
func (*Testing) LintAndInstallChart ¶
func (t *Testing) LintAndInstallChart(chart *Chart) TestResult
LintAndInstallChart first lints and then installs the specified chart.
func (*Testing) LintAndInstallCharts ¶
func (t *Testing) LintAndInstallCharts() ([]TestResult, error)
LintAndInstallCharts first lints and then installs charts (changed, all, specific) depending on the configuration.
func (*Testing) LintChart ¶
func (t *Testing) LintChart(chart *Chart) TestResult
LintChart lints the specified chart.
func (*Testing) LintCharts ¶
func (t *Testing) LintCharts() ([]TestResult, error)
LintCharts lints charts (changed, all, specific) depending on the configuration.
func (*Testing) PrintEventsPodDetailsAndLogs ¶
func (*Testing) PrintResults ¶
func (t *Testing) PrintResults(results []TestResult)
PrintResults writes test results to stdout.
func (*Testing) ReadAllChartDirectories ¶
ReadAllChartDirectories returns a slice of all charts in the configured chart directories except those configured to be excluded.
func (*Testing) UpgradeChart ¶
func (t *Testing) UpgradeChart(chart *Chart) TestResult
UpgradeChart tests in-place upgrades of the specified chart relative to its previous revisions. If the initial install or helm test of a previous revision of the chart fails, that release is ignored and no error will be returned. If the latest revision of the chart introduces a potentially breaking change according to the SemVer specification, upgrade testing will be skipped.