Documentation
¶
Index ¶
- type AccountValidator
- type ChartUtils
- type DirectoryLister
- type Git
- type Helm
- type Kubectl
- type Linter
- type TestResult
- type TestResults
- type Testing
- func (t *Testing) CheckVersionIncrement(chart string) error
- func (t *Testing) ComputeChangedChartDirectories() ([]string, error)
- func (t *Testing) FindChartsToBeProcessed() ([]string, error)
- func (t *Testing) FindValuesFilesForCI(chart string) []string
- func (t *Testing) GetNewChartVersion(chart string) (string, error)
- func (t *Testing) GetOldChartVersion(chart string) (string, error)
- func (t *Testing) InstallChart(chart string, valuesFiles []string) TestResult
- func (t *Testing) InstallCharts() ([]TestResult, error)
- func (t *Testing) LintAndInstallChart(chart string, valuesFiles []string) TestResult
- func (t *Testing) LintAndInstallCharts() ([]TestResult, error)
- func (t *Testing) LintChart(chart string, valuesFiles []string) TestResult
- func (t *Testing) LintCharts() ([]TestResult, error)
- func (t *Testing) PrintPodDetailsAndLogs(namespace string)
- func (t *Testing) PrintResults(results []TestResult)
- func (t *Testing) ReadAllChartDirectories() ([]string, error)
- func (t *Testing) ValidateMaintainers(chart string) 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 ChartUtils ¶
type ChartUtils interface {
IsChartDir(dir string) bool
ReadChartYaml(dir string) (*util.ChartYaml, error)
}
ChartUtils is the interface that wraps chart-related methods
IsChartdir checks if a directory is a chart directory ¶
ReadChartYaml reads the `Chart.yaml` from the specified directory
type DirectoryLister ¶
type DirectoryLister interface {
ListChildDirs(parentDir string, test func(string) bool) ([]string, error)
}
DiretoryLister 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)
MergeBase(commit1 string, commit2 string) (string, error)
ListChangedFilesInDirs(commit string, dirs ...string) ([]string, error)
GetUrlForRemote(remote string) (string, 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.
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.
type Helm ¶
type Helm interface {
Init() error
AddRepo(name string, url string) error
BuildDependencies(chart string) error
Lint(chart string) error
LintWithValues(chart string, valuesFile string) error
Install(chart string, namespace string, release string) error
InstallWithValues(chart string, valuesFile string, namespace string, release string) 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 ¶
Lint runs `helm lint` for the given chart ¶
LintWithValues runs `helm lint` for the given chart using the specified values file ¶
Install runs `helm install` for the given chart ¶
InstallWithValues runs `helm install` for the given chart using the specified values file ¶
DeleteRelease purges the specified Helm release.
type Kubectl ¶
type Kubectl interface {
DeleteNamespace(namespace string)
WaitForDeployments(namespace string) error
GetPodsforDeployment(namespace string, deployment string) ([]string, error)
GetPods(args ...string) ([]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 ¶
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) FindChartsToBeProcessed ¶
FindChartsToBeProcessed identifies charts to be processed depending on the configuration (changed charts, all charts, or specific charts).
func (*Testing) FindValuesFilesForCI ¶
FindValuesFilesForCI returns all files in the 'ci' subfolder of the chart directory matching the pattern '*-values.yaml'
func (*Testing) GetNewChartVersion ¶
GetNewChartVersion gets the new version from the currently checked out Chart.yaml file.
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 string, valuesFiles []string) 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 string, valuesFiles []string) TestResult
LintAndInstallChart first lints and then installs the specified chart.
func (*Testing) LintAndInstallCharts ¶
func (t *Testing) LintAndInstallCharts() ([]TestResult, error)
LintAndInstallChart first lints and then installs charts (changed, all, specific) depending on the configuration.
func (*Testing) LintChart ¶
func (t *Testing) LintChart(chart string, valuesFiles []string) 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) PrintPodDetailsAndLogs ¶
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) ValidateMaintainers ¶
ValidateMaintainers validates maintainers in the Chart.yaml file. Maintainer names must be valid accounts (GitHub, Bitbucket, GitLab) names. Deprecated charts must not have maintainers.