Back to

package environments

Latest Go to latest
Published: Apr 15, 2019 | License: Apache-2.0 | Module:


func AddAppMetaData

func AddAppMetaData(chartDir string, app *jenkinsv1.App, repository string) (*jenkinsv1.App, 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, 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 ModifyChartFiles

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

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

func UpdateAppResource

func UpdateAppResource(helmer helm.Helmer, fetchedChartDir string, outputDir string, name string, repository string) error

UpdateAppResource updates app resource template with app specific metadata

type ConfigureGitFn

type ConfigureGitFn func(dir string, gitInfo *gits.GitRepository, gitAdapter gits.Gitter) error

ConfigureGitFn callback to optionally configure git before its used for creating commits and PRs

type EnvironmentPullRequestOptions

type EnvironmentPullRequestOptions struct {
	Gitter        gits.Gitter
	GitProvider   gits.GitProvider
	ModifyChartFn ModifyChartFn
	ConfigGitFn   ConfigureGitFn

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, and a ConfigureGitFn which is run allowing you to add external git configuration.

func (*EnvironmentPullRequestOptions) Create

func (o *EnvironmentPullRequestOptions) Create(env *jenkinsv1.Environment, environmentsDir string,
	pullRequestDetails *PullRequestDetails, pullRequestInfo *gits.PullRequestInfo) (*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, and a ConfigureGitFn which is run allowing you to add external git configuration. 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.

func (*EnvironmentPullRequestOptions) PullEnvironmentRepo

func (o *EnvironmentPullRequestOptions) PullEnvironmentRepo(env *jenkinsv1.Environment,
	environmentsDir string) (string, string, *gits.GitRepository, bool, error)

PullEnvironmentRepo pulls the repo for env into environmentsDir

func (*EnvironmentPullRequestOptions) PushEnvironmentRepo

func (o *EnvironmentPullRequestOptions) PushEnvironmentRepo(dir string, branchName string,
	gitInfo *gits.GitRepository, base string, pullRequestDetails *PullRequestDetails,
	pullRequestInfo *gits.PullRequestInfo, fork bool) (*gits.PullRequestInfo, error)

PushEnvironmentRepo commits and pushes the changes in the repo rooted at dir. It creates a branch called branchName from a base. It uses the pullRequestDetails for the message and title for the commit and PR. It uses and updates pullRequestInfo to identify whether to rebase an existing PR.

type ModifyChartFn

type ModifyChartFn func(requirements *helm.Requirements, metadata *chart.Metadata, existingValues map[string]interface{},
	templates map[string]string, dir string, pullRequestDetails *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 PullRequestDetails

type PullRequestDetails struct {
	Message    string
	BranchName string
	Title      string

PullRequestDetails is the details for creating a pull request

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

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier