environments

package
v2.0.400-0...-14731b4 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAppMetaData

func AddAppMetaData(chartDir string, app *jenkinsv1.App, repository string) error

AddAppMetaData applies chart metadata to an App resource

func CreateNestedRequirementDir

func CreateNestedRequirementDir(dir string, requirementName string, requirementDir string, requirementVersion string,
	requirementRepository string, verbose bool, requirementValuesFiles *ValuesFiles, helmer helm.Helmer) error

CreateNestedRequirementDir creates the a directory for a chart being added as a requirement, adding a README.md, the release.yaml, and the values.yaml. The dir is the unpacked chart directory to which the requirement is being added. The requirementName, requirementVersion, requirementRepository and requirementValuesFiles are used to construct the metadata, as well as info in the requirementDir which points to the unpacked chart of the requirement.

func EnhanceChartWithAppMetadata

func EnhanceChartWithAppMetadata(chartDir string, app *jenkinsv1.App, repository string, outputDir string,
	filename string) error

EnhanceChartWithAppMetadata will update the app in chartDir with app metadata, writing the custom resource to the outputDir as a new file called filename

func LocateAppResource

func LocateAppResource(helmer helm.Helmer, chartDir string, appName string) (*jenkinsv1.App,
	string, error)

LocateAppResource finds or creates a resource of Kind: App in a given appName rooted in chartDir, writing it to outputDir. The template with the

func ModifyChartFiles

func ModifyChartFiles(dir string, details *gits.PullRequestDetails, modifyFn ModifyChartFn, chartName string) error

ModifyChartFiles modifies the chart files in the given directory using the given modify function

func ModifyDevEnvironmentWithNs

func ModifyDevEnvironmentWithNs(jxClient versioned.Interface, ns string,
	fn func(env *v1.Environment) error) error

ModifyDevEnvironment performs some mutation on the Development environment to modify team settings

Types

type EnvironmentPullRequestOptions

type EnvironmentPullRequestOptions struct {
	Gitter        gits.Gitter
	GitProvider   gits.GitProvider
	ModifyChartFn ModifyChartFn
	Labels        []string
}

EnvironmentPullRequestOptions are options for creating a pull request against an environment. The provide a Gitter client for performing git operations, a GitProvider client for talking to the git provider, a callback ModifyChartFn which is where the changes you want to make are defined,

func (*EnvironmentPullRequestOptions) Create

func (o *EnvironmentPullRequestOptions) Create(env *jenkinsv1.Environment, prDir string,
	pullRequestDetails *gits.PullRequestDetails, filter *gits.PullRequestFilter, chartName string, autoMerge bool) (*gits.PullRequestInfo, error)

Create a pull request against the environment repository for env. The EnvironmentPullRequestOptions are used to provide a Gitter client for performing git operations, a GitProvider client for talking to the git provider, a callback ModifyChartFn which is where the changes you want to make are defined. The branchNameText defines the branch name used, the title is used for both the commit and the pull request title, the message as the body for both the commit and the pull request, and the pullRequestInfo for any existing PR that exists to modify the environment that we want to merge these changes into.

type ModifyChartFn

type ModifyChartFn func(requirements *helm.Requirements, metadata *chart.Metadata, existingValues map[string]interface{},
	templates map[string]string, dir string, pullRequestDetails *gits.PullRequestDetails) error

ModifyChartFn callback for modifying a chart, requirements, the chart metadata, the values.yaml and all files in templates are unmarshaled, and the root dir for the chart is passed

func CreateAddRequirementFn

func CreateAddRequirementFn(chartName string, alias string, version string, repo string,
	valuesFiles *ValuesFiles, chartDir string, verbose bool, helmer helm.Helmer) ModifyChartFn

CreateAddRequirementFn create the ModifyChartFn that adds a dependency to a chart. It takes the chart name, an alias for the chart, the version of the chart, the repo to load the chart from, valuesFiles (an array of paths to values.yaml files to add). The chartDir is the unpacked chart being added, which is used to add extra metadata about the chart (e.g. the charts readme, the release.yaml, the git repo url and the release notes) - if this points to a non-existent directory it will be ignored.

func CreateUpgradeRequirementsFn

func CreateUpgradeRequirementsFn(all bool, chartName string, alias string, version string, username string,
	password string, helmer helm.Helmer, inspectChartFunc func(chartDir string,
		existingValues map[string]interface{}) error, verbose bool, valuesFiles *ValuesFiles) ModifyChartFn

CreateUpgradeRequirementsFn creates the ModifyChartFn that upgrades the requirements of a chart. Either all requirements may be upgraded, or the chartName, alias and version can be specified. A username and password can be passed for a protected repository. The passed inspectChartFunc will be called whilst the chart for each requirement is unpacked on the disk. Operations are carried out using the helmer interface and there will be more logging if verbose is true. The passed valuesFiles are used to add a values.yaml to each requirement.

type ValuesFiles

type ValuesFiles struct {
	Items []string
}

ValuesFiles is a wrapper for a slice of values files to allow them to be passed around as a pointer

Jump to

Keyboard shortcuts

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