bosun

package
v0.0.0-...-614ca16 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 71 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppListColName    = "app"
	AppListColCloned  = "cloned"
	AppListColVersion = "version"
	AppListColRepo    = "repo"
	AppListColBranch  = "branch"
	AppListColDirty   = "dirty"
	AppListColStale   = "stale"
	AppListColPath    = "path"
	AppListColImages  = "images"
	AppListColLabels  = "meta-labels"
)
View Source
const (
	SlotStable       = "stable"
	SlotUnstable     = "unstable"
	SlotPrevious     = "previous"
	PlanFileName     = "plan.yaml"
	ManifestFileName = "manifest.yaml"
)
View Source
const FileProviderName = "file"
View Source
const WorkspaceProviderName = "workspace"

Variables

View Source
var (
	UnstableVersion = semver.New("0.0.0-unstable")
	MaxVersion      = semver.Version{Major: math.MaxInt64}
)

Functions

func ErrAppNotFound

func ErrAppNotFound(name string) error

func IsErrAppNotFound

func IsErrAppNotFound(err error) bool

func NewVersion

func NewVersion(version string) (semver.Version, error)

func ResolveValues

func ResolveValues(collectionProvider values.ValueSetCollectionProvider, ctx BosunContext) (values.ValueSet, error)

Types

type AddDeploymentProgressReports

type AddDeploymentProgressReports []AppDeploymentProgressReport

func (AddDeploymentProgressReports) Headers

func (a AddDeploymentProgressReports) Headers() []string

func (AddDeploymentProgressReports) Rows

func (a AddDeploymentProgressReports) Rows() [][]string

type App

type App struct {
	*AppConfig
	Repo        *Repo // a pointer to the repo if bosun is aware of it
	HelmRelease *HelmRelease

	Provider    AppProvider
	AppManifest *AppManifest
	// contains filtered or unexported fields
}

func NewApp

func NewApp(appConfig *AppConfig) *App

func NewAppFromDependency

func NewAppFromDependency(dep *Dependency) *App

func (*App) BuildImages

func (a *App) BuildImages(req BuildImageRequest) error

func (*App) BumpVersion

func (a *App) BumpVersion(ctx BosunContext, bumpOrVersion string) error

BumpVersion bumps the version (including saving the source fragment and updating the chart. The `bump` parameter may be one of major|minor|patch|major.minor.patch. If major.minor.patch is provided, the version is set to that value.

func (*App) CheckOutBranch

func (a *App) CheckOutBranch(name git.BranchName) error

func (*App) CheckRepoCloned

func (a *App) CheckRepoCloned() error

func (*App) Dir

func (a *App) Dir() string

func (*App) ExportActions

func (a *App) ExportActions(ctx BosunContext) ([]*actions.AppAction, error)

func (*App) ExportValues

func (a *App) ExportValues(ctx BosunContext) (values.ValueSetCollection, error)

ExportValues creates an ValueSetCollection instance with all the values for releasing this app, reified into their environments, including values from files and from the default values.yaml file for the chart.

func (*App) GetAbsolutePathToChart

func (a *App) GetAbsolutePathToChart() string

func (*App) GetBranchName

func (a *App) GetBranchName() git.BranchName

func (*App) GetCommit

func (a *App) GetCommit() string

func (*App) GetLabels

func (a *App) GetLabels() filter.Labels

func (*App) GetLocalRepoPath

func (a *App) GetLocalRepoPath() (string, error)

func (*App) GetManifest

func (a *App) GetManifest(ctx BosunContext) (*AppManifest, error)

func (*App) GetManifestFromBranch

func (a *App) GetManifestFromBranch(ctx BosunContext, branch string, makePortable bool) (*AppManifest, error)

func (*App) GetMostRecentCommitFromBranch

func (a *App) GetMostRecentCommitFromBranch(ctx BosunContext, branch string) (string, error)

func (*App) GetMostRecentReleaseVersion

func (a *App) GetMostRecentReleaseVersion() *semver.Version

func (*App) GetPrefixedImageNames

func (a *App) GetPrefixedImageNames() []string

GetPrefixedImageNames returns the untagged names of the images for this repo.

func (*App) GetRepoPath

func (a *App) GetRepoPath() string

func (*App) GetRunCommand

func (a *App) GetRunCommand() (*exec.Cmd, error)

func (*App) GetTaggedImageNames

func (a *App) GetTaggedImageNames(versionAndRelease ...string) []string

GetImageName returns the image name with the tags appended. If no arguments are provided, it will be tagged "latest"; if one arg is provided it will be used as the tag; if 2 args are provided it will be tagged "arg[0]-arg[1]".

func (*App) HasChart

func (a *App) HasChart() bool

func (*App) IsRepoCloned

func (a *App) IsRepoCloned() bool

func (*App) ProviderName

func (a *App) ProviderName() string

func (*App) PublishChart

func (a *App) PublishChart(ctx BosunContext, force bool) error

type AppConfig

type AppConfig struct {
	core.ConfigShared       `yaml:",inline"`
	ProjectManagementPlugin *ProjectManagementPlugin `yaml:"projectManagementPlugin,omitempty" json:"projectManagementPlugin,omitempty"`
	BranchForRelease        bool                     `yaml:"branchForRelease,omitempty" json:"branchForRelease,omitempty"`
	Branching               git.BranchSpec           `yaml:"branching,omitempty" json:"branching"`
	// ContractsOnly means that the app doesn't have any compiled/deployed code, it just defines contracts or documentation.
	ContractsOnly bool `yaml:"contractsOnly,omitempty" json:"contractsOnly,omitempty"`
	// FilesOnly means the app consists only of the files referenced in the bosun file, with no compiled code.
	FilesOnly        bool           `yaml:"filesOnly,omitempty" json:"filesOnly,omitempty"`
	ReportDeployment bool           `yaml:"reportDeployment,omitempty" json:"reportDeployment,omitempty"`
	RepoName         string         `yaml:"repo,omitempty" json:"repo,omitempty"`
	HarborProject    string         `yaml:"harborProject,omitempty" json:"harborProject,omitempty"`
	Version          semver.Version `yaml:"version,omitempty" json:"version,omitempty"`
	// The location of a standard go version file for this app.
	GoVersionFile string                    `yaml:"goVersionFile,omitempty" json:"goVersionFile,omitempty"`
	Chart         string                    `yaml:"chart,omitempty" json:"chart,omitempty"`
	ChartPath     string                    `yaml:"chartPath,omitempty" json:"chartPath,omitempty"`
	RunCommand    []string                  `yaml:"runCommand,omitempty,flow" json:"runCommand,omitempty,flow"`
	DependsOn     []Dependency              `yaml:"dependsOn,omitempty" json:"dependsOn,omitempty"`
	Labels        filter.Labels             `yaml:"labels,omitempty" json:"labels,omitempty"`
	Minikube      *AppMinikubeConfig        `yaml:"minikube,omitempty" json:"minikube,omitempty"`
	Images        []AppImageConfig          `yaml:"images" json:"images"`
	ValueMappings values.ValueMappings      `yaml:"valueMappings,omitempty"`
	Values        values.ValueSetCollection `yaml:"values,omitempty" json:"values,omitempty"`
	Scripts       []*script.Script          `yaml:"scripts,omitempty" json:"scripts,omitempty"`
	Actions       []*actions.AppAction      `yaml:"actions,omitempty" json:"actions,omitempty"`
	// Glob paths (relative to the file containing the app config)
	// to files and folders  which should be included when the app is packaged for a release or a deployment.
	// In particular, the path to the chart should be included.
	Files          []string          `yaml:"files"`
	ReleaseHistory AppReleaseHistory `yaml:"releaseHistory" json:"releaseHistory,omitempty"`

	// If true, this app repo is only a ref, not a real cloned repo.
	IsRef          bool `yaml:"-" json:"-"`
	IsFromManifest bool `yaml:"-"` // Will be true if this config was embedded in an AppManifest.

	ProviderInfo string `yaml:"providerInfo,omitempty"`
	// contains filtered or unexported fields
}

func (*AppConfig) AddReleaseToHistory

func (a *AppConfig) AddReleaseToHistory(releaseVersion string)

func (*AppConfig) ErrIfFromManifest

func (a *AppConfig) ErrIfFromManifest(msg string, args ...interface{}) error

func (*AppConfig) GetImages

func (a *AppConfig) GetImages() []AppImageConfig

func (*AppConfig) GetValueSetCollection

func (p *AppConfig) GetValueSetCollection() values.ValueSetCollection

func (*AppConfig) LoadChartValues

func (a *AppConfig) LoadChartValues() (values.ValueSet, error)

func (*AppConfig) MarshalYAML

func (a *AppConfig) MarshalYAML() (interface{}, error)

func (*AppConfig) SetFromPath

func (a *AppConfig) SetFromPath(fromPath string)

func (*AppConfig) UnmarshalYAML

func (a *AppConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type AppConfigAppProvider

type AppConfigAppProvider struct {
	// contains filtered or unexported fields
}

func NewAppConfigAppProvider

func NewAppConfigAppProvider(ws *Workspace, log *logrus.Entry) AppConfigAppProvider

func (AppConfigAppProvider) GetAllApps

func (a AppConfigAppProvider) GetAllApps() (map[string]*App, error)

func (AppConfigAppProvider) ProvideApp

func (a AppConfigAppProvider) ProvideApp(req AppProviderRequest) (*App, error)

func (AppConfigAppProvider) String

func (a AppConfigAppProvider) String() string

type AppDeploy

type AppDeploy struct {
	Name        string       `yaml:"name,omitempty"`
	AppManifest *AppManifest `yaml:"appManifest,omitempty"`
	AppConfig   *AppConfig   `yaml:"appConfig,omitempty"`

	FromPath          string             `yaml:"fromPath,omitempty"`
	Excluded          bool               `yaml:"excluded,omitempty"`
	ActualState       workspace.AppState `yaml:"actualState,omitempty"`
	DesiredState      workspace.AppState `yaml:"desiredState,omitempty"`
	Namespace         string             `yaml:"namespace,omitempty"`
	AppDeploySettings AppDeploySettings  `yaml:"appDeploySettings,omitempty"`

	MatchArgs filter.MatchMapArgs `yaml:"matchArgs,omitempty"`

	StackApp *kube.StackApp `yaml:"-"`
	// contains filtered or unexported fields
}

func NewAppDeploy

func NewAppDeploy(ctx BosunContext, settings DeploySettings, manifest *AppManifest) (*AppDeploy, error)

func (*AppDeploy) Chart

func (a *AppDeploy) Chart(ctx BosunContext) string

Chart gets the path to the chart, or the full name of the chart.

func (*AppDeploy) Clone

func (a *AppDeploy) Clone() *AppDeploy

func (*AppDeploy) Delete

func (a *AppDeploy) Delete(ctx BosunContext) error

func (*AppDeploy) GetHelmList

func (a *AppDeploy) GetHelmList(filter string, namespace string) ([]*HelmRelease, error)

func (*AppDeploy) GetHelmRelease

func (a *AppDeploy) GetHelmRelease(name string, namespace string) (*HelmRelease, error)

func (*AppDeploy) GetLabels

func (a *AppDeploy) GetLabels() filter.Labels

func (*AppDeploy) GetResolvedValues

func (a *AppDeploy) GetResolvedValues(ctx BosunContext) (*values.PersistableValues, error)

GetResolvedValues handles loading and merging all values needed for the deployment of the app, including reading the default helm chart values, loading any values files, and resolving any dynamic values.

func (*AppDeploy) GetStatus

func (a *AppDeploy) GetStatus() (string, error)

func (*AppDeploy) Install

func (a *AppDeploy) Install(ctx BosunContext) error

func (*AppDeploy) LoadActualState

func (a *AppDeploy) LoadActualState(ctx BosunContext, diff bool) error

func (*AppDeploy) PlanReconciliation

func (a *AppDeploy) PlanReconciliation(ctx BosunContext) (Plan, error)

func (*AppDeploy) Reconcile

func (a *AppDeploy) Reconcile(ctx BosunContext) error

func (*AppDeploy) Recycle

func (a *AppDeploy) Recycle(ctx BosunContext) error

func (*AppDeploy) Render

func (a *AppDeploy) Render(ctx BosunContext) (string, error)

func (*AppDeploy) ReportDeployment

func (a *AppDeploy) ReportDeployment(ctx BosunContext) (cleanup func(error), err error)

func (*AppDeploy) Rollback

func (a *AppDeploy) Rollback(ctx BosunContext) error

func (*AppDeploy) RouteToLocalhost

func (a *AppDeploy) RouteToLocalhost(ctx BosunContext, namespace string) error

func (*AppDeploy) Upgrade

func (a *AppDeploy) Upgrade(ctx BosunContext) error

func (*AppDeploy) Validate

func (a *AppDeploy) Validate(ctx BosunContext) []error

func (*AppDeploy) WithValueSet

func (a *AppDeploy) WithValueSet(v values.ValueSet) *AppDeploy

type AppDeployMap

type AppDeployMap map[string]*AppDeploy

func (AppDeployMap) GetAppsSortedByName

func (a AppDeployMap) GetAppsSortedByName() AppReleasesSortedByName

type AppDeploySettings

type AppDeploySettings struct {
	SharedDeploySettings
	ValueSets         []values.ValueSet
	PlatformAppConfig *PlatformAppConfig
}

type AppDeploymentPlan

type AppDeploymentPlan struct {
	Name           string          `yaml:"name"`
	Tag            string          `yaml:"tag"`
	ValueOverrides values.ValueSet `yaml:"valueOverrides"`
	ManifestPath   string          `yaml:"manifestPath"`
	Manifest       *AppManifest    `yaml:"-"`
}

type AppDeploymentProgress

type AppDeploymentProgress struct {
	AppName   string    `yaml:"appName"`
	Stack     string    `yaml:"stack"`
	Hash      string    `yaml:"hash"`
	Timestamp time.Time `yaml:"timestamp"`
	Error     string    `yaml:"error,omitempty"`
}

type AppDeploymentProgressReport

type AppDeploymentProgressReport struct {
	Progress  AppDeploymentProgress
	Plan      AppDeploymentPlan
	OutOfSync bool
	Status    string
}

type AppHashes

type AppHashes struct {
	// Commit hash that this app manifest was created from.
	// Empty if the app is stored in the platform repo.
	Commit string `yaml:"commit,omitempty"`
	// AppConfig hash, created by hashing the bosun file.
	AppConfig string `yaml:"appConfig,omitempty"`
	// Files hash, created by hashing all files included in the app manifest by the bosunfile.
	Files string `yaml:"files,omitempty"`
}

func (AppHashes) Changes

func (a AppHashes) Changes(other AppHashes) (string, bool)

func (AppHashes) String

func (a AppHashes) String() string

func (AppHashes) Summarize

func (a AppHashes) Summarize() string

Summarize returns a hash of the hashes, for when you don't need to tell where the changes are.

type AppImageConfig

type AppImageConfig struct {
	ImageName    string   `yaml:"imageName" json:"imageName,omitempty"`
	Repository   string   `yaml:"repository,omitempty" json:"repository,omitempty"`
	ProjectName  string   `yaml:"projectName,omitempty" json:"projectName,omitempty"`
	Dockerfile   string   `yaml:"dockerfile,omitempty" json:"dockerfile,omitempty"`
	ContextPath  string   `yaml:"contextPath,omitempty" json:"contextPath,omitempty"`
	BuildCommand []string `yaml:"buildCommand,omitempty" json:"buildCommand,omitempty"`
	BuildArgs    []string `yaml:"buildArgs,omitempty" json:"buildArgs,omitempty"`
}

func (AppImageConfig) GetFullName

func (a AppImageConfig) GetFullName() string

func (AppImageConfig) GetFullNameWithTag

func (a AppImageConfig) GetFullNameWithTag(tag string) string

func (*AppImageConfig) MarshalYAML

func (a *AppImageConfig) MarshalYAML() (interface{}, error)

func (*AppImageConfig) UnmarshalYAML

func (a *AppImageConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type AppImageHelper

type AppImageHelper struct {
	Bosun *Bosun
}

func NewAppImageHelper

func NewAppImageHelper(b *Bosun) AppImageHelper

func (AppImageHelper) PublishImages

func (x AppImageHelper) PublishImages(req PublishImagesRequest) error

type AppList

type AppList []*App

func (AppList) CheckOutDevelop

func (a AppList) CheckOutDevelop(logger Logger) error

func (AppList) FetchAll

func (a AppList) FetchAll(logger Logger) error

func (AppList) Filter

func (a AppList) Filter(fn func(a *App) bool) AppList

func (AppList) FlatMap

func (a AppList) FlatMap(fn func(a *App) []interface{}) []interface{}

func (AppList) ForEachRepo

func (a AppList) ForEachRepo(fn func(app *App) error) error

func (AppList) GroupByAppThenProvider

func (a AppList) GroupByAppThenProvider() map[string]map[string]*App

func (AppList) Headers

func (a AppList) Headers() []string

func (AppList) Map

func (a AppList) Map(fn func(a *App) interface{}) []interface{}

func (AppList) Rows

func (a AppList) Rows() [][]string

func (AppList) Sort

func (a AppList) Sort(less func(a, b *App) bool) AppList

func (AppList) SortByName

func (a AppList) SortByName() AppList

func (AppList) SortByProvider

func (a AppList) SortByProvider() AppList

func (AppList) ToMap

func (a AppList) ToMap() AppMap

type AppManifest

type AppManifest struct {
	*AppMetadata `yaml:"metadata"`
	AppConfig    *AppConfig        `yaml:"appConfig" json:"appConfig"`
	Files        map[string][]byte `yaml:"-" json:"-"`
}

AppManifest contains the configuration for an app in a ReleaseManifest as part of a Platform. Instances should be manipulated using methods on Platform, not updated directly.

func LoadAppManifestFromPathAndName

func LoadAppManifestFromPathAndName(fileOrDir string, name string) (*AppManifest, error)

func (*AppManifest) GetTagBasedOnVersionAndBranch

func (a *AppManifest) GetTagBasedOnVersionAndBranch() string

func (*AppManifest) MakePortable

func (a *AppManifest) MakePortable() error

func (*AppManifest) MarshalYAML

func (a *AppManifest) MarshalYAML() (interface{}, error)

func (*AppManifest) Save

func (a *AppManifest) Save(dir string) (string, error)

Save saves the app manifest in the provided directory. It return the path to the bosun file which was saved and contains the manifest.

func (*AppManifest) UnmarshalYAML

func (a *AppManifest) UnmarshalYAML(unmarshal func(interface{}) error) error

func (*AppManifest) UpdateBosunfileHash

func (a *AppManifest) UpdateBosunfileHash() error

func (*AppManifest) UpdateFilesHash

func (a *AppManifest) UpdateFilesHash() error

func (*AppManifest) UpdateHashes

func (a *AppManifest) UpdateHashes() error

type AppMap

type AppMap map[string]*App

func (AppMap) ToList

func (a AppMap) ToList() AppList

type AppMetadata

type AppMetadata struct {
	Name                 string          `yaml:"name" json:"name"`
	Repo                 string          `yaml:"repo" json:"repo"`
	Version              semver.Version  `yaml:"version" json:"version"`
	PinnedReleaseVersion *semver.Version `yaml:"pinnedReleaseVersion,omitempty"`
	Hashes               AppHashes       `yaml:"hashes"`
	Branch               string          `yaml:"branch" json:"branch"`
	Tag                  string          `yaml:"tag,omitempty" json:"tag,omitempty"`
}

func (AppMetadata) DiffersFrom

func (a AppMetadata) DiffersFrom(other *AppMetadata) bool

func (AppMetadata) Format

func (a AppMetadata) Format(f fmt.State, c rune)

func (*AppMetadata) PinToRelease

func (a *AppMetadata) PinToRelease(release *ReleaseMetadata)

func (*AppMetadata) PinToReleaseVersion

func (a *AppMetadata) PinToReleaseVersion(version semver.Version)

func (*AppMetadata) RepoRef

func (a *AppMetadata) RepoRef() issues.RepoRef

func (AppMetadata) String

func (a AppMetadata) String() string

type AppMinikubeConfig

type AppMinikubeConfig struct {
	// The ports which should be made exposed through nodePorts
	// when running on minikube.
	Ports []int `yaml:"ports,omitempty" json:"ports,omitempty"`
	// The services which should be replaced when toggling an
	// app to run on the host.
	RoutableServices []AppRoutableService `yaml:"routableServices" json:"routableServices"`
}

type AppProvider

type AppProvider interface {
	fmt.Stringer
	ProvideApp(req AppProviderRequest) (*App, error)
	GetAllApps() (map[string]*App, error)
}

type AppProviderGroup

type AppProviderGroup interface {
	GetAppFromProvider(appName string, providerName string) (*App, error)
}

type AppProviderRequest

type AppProviderRequest struct {
	Name             string   `json:"name,omitempty"`
	ProviderPriority []string `json:"providerPriority,omitempty"`
	Path             string   `json:"path,omitempty"`
	Branch           string   `json:"branch,omitempty"`
	ForceReload      bool     `json:"forceReload"`
}

func (AppProviderRequest) String

func (r AppProviderRequest) String() string

type AppReleaseHistory

type AppReleaseHistory []AppReleaseHistoryEntry

type AppReleaseHistoryEntry

type AppReleaseHistoryEntry struct {
	ReleaseVersion string
	Version        string
}

type AppReleasesSortedByName

type AppReleasesSortedByName []*AppDeploy

func (AppReleasesSortedByName) Len

func (a AppReleasesSortedByName) Len() int

func (AppReleasesSortedByName) Less

func (a AppReleasesSortedByName) Less(i, j int) bool

func (AppReleasesSortedByName) Swap

func (a AppReleasesSortedByName) Swap(i, j int)

type AppRoutableService

type AppRoutableService struct {
	Name     string `yaml:"name" json:"name,omitempty"`
	PortName string `yaml:"portName" json:"portName,omitempty"`
	// Deprecated, use localhostPort instead
	ExternalPort int `yaml:"externalPort,omitempty" json:"externalPort,omitempty"`
	// The port the service should advertise within the cluster.
	InternalPort  int    `yaml:"internalPort" json:"internalPort"`
	LocalhostPort int    `yaml:"localhostPort" json:"localhostPort,omitempty"`
	Namespace     string `yaml:"namespace"`
}

type AppsAndDependencies

type AppsAndDependencies struct {
	Apps             map[string]*App
	Dependencies     map[string][]string
	TopologicalOrder []string
}

type AppsSortedByName

type AppsSortedByName []*App

func (AppsSortedByName) Len

func (a AppsSortedByName) Len() int

func (AppsSortedByName) Less

func (a AppsSortedByName) Less(i, j int) bool

func (AppsSortedByName) Swap

func (a AppsSortedByName) Swap(i, j int)

type Bosun

type Bosun struct {
	// contains filtered or unexported fields
}

func New

func New(params cli.Parameters, ws *Workspace) (*Bosun, error)

func (*Bosun) AddGitRoot

func (b *Bosun) AddGitRoot(s string)

func (*Bosun) AddImport

func (b *Bosun) AddImport(file string) bool

func (*Bosun) AddLocalRepo

func (b *Bosun) AddLocalRepo(localRepo *vcs.LocalRepo)

func (*Bosun) ClearImports

func (b *Bosun) ClearImports()

func (*Bosun) ConfirmEnvironment

func (b *Bosun) ConfirmEnvironment() error

Confirm environment checks that the environment has been confirmed by the user if the environment is marked as protected.

func (*Bosun) EnsureTool

func (b *Bosun) EnsureTool(name string) error

func (*Bosun) GetAllApps

func (b *Bosun) GetAllApps() AppMap

func (*Bosun) GetAllProviderNames

func (b *Bosun) GetAllProviderNames() []string

func (*Bosun) GetAllVersionsOfAllApps

func (b *Bosun) GetAllVersionsOfAllApps(providerPriority ...string) (AppList, error)

GetAllVersionsOfAllApps gets all apps from all providers, ignoring provider priority.

func (*Bosun) GetApp

func (b *Bosun) GetApp(name string, providerPriority ...string) (*App, error)

func (*Bosun) GetAppDependencies

func (b *Bosun) GetAppDependencies(name string) ([]string, error)

func (*Bosun) GetAppDependencyMap

func (b *Bosun) GetAppDependencyMap() map[string][]string

func (*Bosun) GetAppFromProvider

func (b *Bosun) GetAppFromProvider(appName, providerName string) (*App, error)

func (*Bosun) GetAppFromRepo

func (b *Bosun) GetAppFromRepo(repoName string) (*App, error)

func (*Bosun) GetAppFromWorkspace

func (b *Bosun) GetAppFromWorkspace(appName string) (*App, error)

func (*Bosun) GetAppRefs

func (b *Bosun) GetAppRefs() apps.AppRefList

func (*Bosun) GetCluster

func (b *Bosun) GetCluster(cluster brns.StackBrn) (*kube.ClusterConfig, error)

func (*Bosun) GetCurrentBrn

func (b *Bosun) GetCurrentBrn() (stack brns.StackBrn, err error)

func (*Bosun) GetCurrentCluster

func (b *Bosun) GetCurrentCluster() (*kube.Cluster, error)

func (*Bosun) GetCurrentClusterName

func (b *Bosun) GetCurrentClusterName(env *environment.Config) (string, error)

func (*Bosun) GetCurrentEnvironment

func (b *Bosun) GetCurrentEnvironment() *environment.Environment

func (*Bosun) GetCurrentPlatform

func (b *Bosun) GetCurrentPlatform() (*Platform, error)

func (*Bosun) GetCurrentStack

func (b *Bosun) GetCurrentStack() (*kube.Stack, error)

func (*Bosun) GetDeployer

func (b *Bosun) GetDeployer(repo issues.RepoRef) (*git.Deployer, error)

func (*Bosun) GetEnvironmentAndCluster

func (b *Bosun) GetEnvironmentAndCluster(stack brns.StackBrn) (*environment.Config, *kube.ClusterConfig, error)

func (*Bosun) GetEnvironmentConfig

func (b *Bosun) GetEnvironmentConfig(environmentOrClusterName string) (*environment.Config, error)

func (*Bosun) GetEnvironments

func (b *Bosun) GetEnvironments() ([]*environment.Config, error)

func (*Bosun) GetGitRoots

func (b *Bosun) GetGitRoots() []string

func (*Bosun) GetGithubToken

func (b *Bosun) GetGithubToken() (string, error)

func (*Bosun) GetInWorkspace

func (b *Bosun) GetInWorkspace(path string) (interface{}, error)

func (*Bosun) GetIssueService

func (b *Bosun) GetIssueService() (issues.IssueService, error)

func (*Bosun) GetMergedConfig

func (b *Bosun) GetMergedConfig() File

func (*Bosun) GetOrAddAppForPath

func (b *Bosun) GetOrAddAppForPath(path string) (*App, error)

func (*Bosun) GetPlatform

func (b *Bosun) GetPlatform(name string) (*Platform, error)

func (*Bosun) GetPlatformApps

func (b *Bosun) GetPlatformApps() AppMap

func (*Bosun) GetPlatforms

func (b *Bosun) GetPlatforms() ([]*Platform, error)

func (*Bosun) GetRepo

func (b *Bosun) GetRepo(name string) (*Repo, error)

func (*Bosun) GetRepoInfo

func (b *Bosun) GetRepoInfo() ([]RepoInfo, error)

func (*Bosun) GetRepos

func (b *Bosun) GetRepos() []*Repo

func (*Bosun) GetScript

func (b *Bosun) GetScript(name string) (*script.Script, error)

func (*Bosun) GetScripts

func (b *Bosun) GetScripts() []*script.Script

func (*Bosun) GetStableReleaseManifest

func (b *Bosun) GetStableReleaseManifest() (*ReleaseManifest, error)

func (*Bosun) GetStoryHandlerConfiguration

func (b *Bosun) GetStoryHandlerConfiguration() []values.Values

func (*Bosun) GetTestSuite

func (b *Bosun) GetTestSuite(name string) (*E2ESuite, error)

func (*Bosun) GetTestSuiteConfigs

func (b *Bosun) GetTestSuiteConfigs() []*E2ESuiteConfig

func (*Bosun) GetTool

func (b *Bosun) GetTool(name string) (ToolDef, error)

func (*Bosun) GetTools

func (b *Bosun) GetTools() []*ToolDef

func (*Bosun) GetValueSet

func (b *Bosun) GetValueSet(name string) (values.ValueSet, error)

func (*Bosun) GetValueSetSlice

func (b *Bosun) GetValueSetSlice(names []string) ([]values.ValueSet, error)

func (*Bosun) GetValueSets

func (b *Bosun) GetValueSets() values.ValueSets

func (*Bosun) GetValueSetsForEnv

func (b *Bosun) GetValueSetsForEnv(env *environment.Config) ([]values.ValueSet, error)

func (*Bosun) GetVaultClient

func (b *Bosun) GetVaultClient() (*vaultapi.Client, error)

func (*Bosun) GetWorkspace

func (b *Bosun) GetWorkspace() *Workspace

func (*Bosun) NewContext

func (b *Bosun) NewContext() BosunContext

func (*Bosun) NewContextWithoutEnvironment

func (b *Bosun) NewContextWithoutEnvironment() BosunContext

func (*Bosun) NormalizeStackBrn

func (b *Bosun) NormalizeStackBrn(hint string) (brns.StackBrn, error)

func (*Bosun) ProvideApp

func (b *Bosun) ProvideApp(req AppProviderRequest) (*App, error)

func (*Bosun) ReloadApp

func (b *Bosun) ReloadApp(name string) (*App, error)

func (*Bosun) RequireTool

func (b *Bosun) RequireTool(name string) error

func (*Bosun) Save

func (b *Bosun) Save() error

func (*Bosun) SaveAndReload

func (b *Bosun) SaveAndReload() error

func (*Bosun) SetInWorkspace

func (b *Bosun) SetInWorkspace(path string, value interface{}) error

func (*Bosun) TidyWorkspace

func (b *Bosun) TidyWorkspace(dryRun bool) error

TidyWorkspace updates the ClonePaths in the workspace based on the apps found in the imported files.

func (*Bosun) UsePlatform

func (b *Bosun) UsePlatform(name string) error

func (*Bosun) UseRelease

func (b *Bosun) UseRelease(versionString string) error

func (*Bosun) UseStack

func (b *Bosun) UseStack(stack brns.StackBrn) error

Configures the workspace to use the specified environment and cluster, and activates them.

type BosunContext

type BosunContext struct {
	Bosun *Bosun

	Dir string

	Values *values.PersistableValues
	// contains filtered or unexported fields
}

func NewTestBosunContext

func NewTestBosunContext() BosunContext

NewTestBosunContext creates a new BosunContext for testing purposes. In production code a context should always be obtained from a Bosun instance.

func WithE2EContext

func WithE2EContext(ctx BosunContext, e2eCtx E2EContext) BosunContext

func (BosunContext) Cluster

func (c BosunContext) Cluster() *kube.Cluster

func (BosunContext) Ctx

func (c BosunContext) Ctx() context.Context

func (BosunContext) Environment

func (c BosunContext) Environment() *environment.Environment

func (BosunContext) GetClusterName

func (c BosunContext) GetClusterName() string

func (BosunContext) GetEnvironmentVariables

func (c BosunContext) GetEnvironmentVariables() map[string]string

func (BosunContext) GetMatchMapArgs

func (c BosunContext) GetMatchMapArgs() filter.MatchMapArgs

func (BosunContext) GetMinikubeDockerEnv

func (c BosunContext) GetMinikubeDockerEnv() []string

func (BosunContext) GetParameters

func (c BosunContext) GetParameters() cli.Parameters

func (BosunContext) GetPlatform

func (c BosunContext) GetPlatform() *Platform

func (BosunContext) GetReleaseValues

func (c BosunContext) GetReleaseValues() *values.PersistableValues

func (BosunContext) GetStringValue

func (c BosunContext) GetStringValue(key string, defaultValue ...string) string

func (BosunContext) GetTemplateHelper

func (c BosunContext) GetTemplateHelper() (*templating.TemplateHelper, error)

func (BosunContext) GetValue

func (c BosunContext) GetValue(key string, defaultValue ...interface{}) interface{}

func (BosunContext) GetVaultClient

func (c BosunContext) GetVaultClient() (*vault.Client, error)

func (BosunContext) GetWorkspaceCommand

func (c BosunContext) GetWorkspaceCommand(name string, hint string) *command.CommandValue

func (BosunContext) HasEnvironment

func (c BosunContext) HasEnvironment() bool

func (BosunContext) IsVerbose

func (c BosunContext) IsVerbose() bool

func (BosunContext) Log

func (c BosunContext) Log() *logrus.Entry

Log gets a logger safely.

func (BosunContext) LogLine

func (c BosunContext) LogLine(skip int, format string, args ...interface{})

func (BosunContext) Provide

func (c BosunContext) Provide(out interface{}, options ...ioc.Options) error

func (BosunContext) Pwd

func (c BosunContext) Pwd() string

func (BosunContext) ResolvePath

func (c BosunContext) ResolvePath(path string, expansions ...string) string

ResolvePath resolves the path relative to the Dir in this context. It will also expand some environment variables: $ENVIRONMENT and $BOSUN_ENVIRONMENT => Env.Name $DOMAIN AND BOSUN_DOMAIN => Env.Domain It will also include any additional expansions provided.

func (BosunContext) Services

func (c BosunContext) Services() Services

func (BosunContext) Stack

func (c BosunContext) Stack() *kube.Stack

func (BosunContext) TemplateValues

func (c BosunContext) TemplateValues() templating.TemplateValues

func (BosunContext) WithApp

func (c BosunContext) WithApp(a *App) BosunContext

func (BosunContext) WithAppDeploy

func (c BosunContext) WithAppDeploy(a *AppDeploy) BosunContext

func (BosunContext) WithContext

func (c BosunContext) WithContext(ctx context.Context) BosunContext

func (BosunContext) WithDir

func (c BosunContext) WithDir(dirOrFilePath string) BosunContext

func (BosunContext) WithEnv

func (c BosunContext) WithEnv(env *environment.Environment) interface{}

func (BosunContext) WithLog

func (c BosunContext) WithLog(log *logrus.Entry) BosunContext

func (BosunContext) WithLogField

func (c BosunContext) WithLogField(key string, value interface{}) util.WithLogFielder

func (BosunContext) WithMatchMapArgs

func (c BosunContext) WithMatchMapArgs(args filter.MatchMapArgs) interface{}

func (BosunContext) WithPersistableValues

func (c BosunContext) WithPersistableValues(v *values.PersistableValues) interface{}

func (BosunContext) WithPwd

func (c BosunContext) WithPwd(pwd string) cli.WithPwder

func (BosunContext) WithStringValue

func (c BosunContext) WithStringValue(key string, value string) core.StringKeyValuer

func (BosunContext) WithTimeout

func (c BosunContext) WithTimeout(timeout time.Duration) core.Ctxer

func (BosunContext) WithValue

func (c BosunContext) WithValue(key string, value interface{}) core.StringKeyValuer

func (BosunContext) WithWorkspaceContext

func (c BosunContext) WithWorkspaceContext(ctx workspace.Context) BosunContext

func (BosunContext) WorkspaceContext

func (c BosunContext) WorkspaceContext() workspace.Context

type BuildImageRequest

type BuildImageRequest struct {
	Pattern string
	Ctx     BosunContext
}

type BundleFile

type BundleFile struct {
	App     string `yaml:"namespace"`
	Path    string `yaml:"path"`
	Content []byte `yaml:"-"`
}

type BundleInfo

type BundleInfo struct {
	Environments map[string]*environment.Config
}

type BundlePlatformRequest

type BundlePlatformRequest struct {
	Dir string
}

type BundlePlatformResult

type BundlePlatformResult struct {
	Request *BundlePlatformRequest
	OutPath string
}

type ChainAppProvider

type ChainAppProvider struct {
	// contains filtered or unexported fields
}

func NewChainAppProvider

func NewChainAppProvider(providers ...AppProvider) ChainAppProvider

func (ChainAppProvider) GetAllApps

func (a ChainAppProvider) GetAllApps(providerPriority []string) (map[string]*App, error)

func (ChainAppProvider) GetAllAppsList

func (a ChainAppProvider) GetAllAppsList(providerNames []string) (AppList, error)

func (ChainAppProvider) GetAllVersionsOfApp

func (a ChainAppProvider) GetAllVersionsOfApp(name string, providerNames []string) (AppList, error)

func (ChainAppProvider) GetApp

func (a ChainAppProvider) GetApp(req AppProviderRequest) (*App, error)

func (ChainAppProvider) GetAppFromProvider

func (a ChainAppProvider) GetAppFromProvider(name string, providerName string) (*App, error)

func (ChainAppProvider) String

func (a ChainAppProvider) String() string

type CreateDeploymentPlanRequest

type CreateDeploymentPlanRequest struct {
	Path             string
	ManifestDirPath  string
	ProviderPriority []string
	// Basic way to request apps with default behaviors
	Apps []string
	// Advanced parameter to customize how apps get resolved
	AppOptions            map[string]AppProviderRequest
	IgnoreDependencies    bool
	AutomaticDependencies bool
	ReleaseVersion        *semver.Version
	BasedOnHash           string
}

type Dependencies

type Dependencies []Dependency

func (Dependencies) Len

func (d Dependencies) Len() int

func (Dependencies) Less

func (d Dependencies) Less(i, j int) bool

func (Dependencies) Swap

func (d Dependencies) Swap(i, j int)

type DependenciesSortedByTopology

type DependenciesSortedByTopology []string

func GetDependenciesInTopologicalOrder

func GetDependenciesInTopologicalOrder(apps map[string][]string, roots ...string) (DependenciesSortedByTopology, error)

type Dependency

type Dependency struct {
	Name     string         `yaml:"name" json:"name,omitempty"`
	FromPath string         `yaml:"-" json:"fromPath,omitempty"`
	Repo     string         `yaml:"repo,omitempty" json:"repo,omitempty"`
	Version  semver.Version `yaml:"version,omitempty" json:"version,omitempty"`
}

type Deploy

type Deploy struct {
	*DeploySettings
	AppDeploys []*AppDeploy
	Filtered   map[string]bool // contains any app deploys which were part of the release but which were filtered out
}

func NewDeploy

func NewDeploy(ctx BosunContext, settings DeploySettings) (*Deploy, error)

func (*Deploy) Deploy

func (d *Deploy) Deploy(ctx BosunContext) error

type DeploySettings

type DeploySettings struct {
	SharedDeploySettings
	ValueSets          []values.ValueSet
	Manifest           *ReleaseManifest
	Apps               map[string]*App
	AppManifests       map[string]*AppManifest
	AppDeploySettings  map[string]AppDeploySettings
	AppOrder           []string
	Filter             *filter.Chain // If set, only apps which match the filter will be deployed.
	IgnoreDependencies bool
	ForceDeployApps    map[string]bool
	AfterDeploy        func(app *AppDeploy, err error)
}

func (DeploySettings) GetAppDeploySettings

func (d DeploySettings) GetAppDeploySettings(name string) AppDeploySettings

func (DeploySettings) GetImageTag

func (d DeploySettings) GetImageTag(appMetadata *AppMetadata) string

func (DeploySettings) WithValueSets

func (d DeploySettings) WithValueSets(valueSets ...values.ValueSet) DeploySettings

type DeploymentPlan

type DeploymentPlan struct {
	core.ConfigShared `yaml:",inline"`
	ReleaseVersion    *semver.Version `yaml:"releaseVersion"`
	// Hash of the release this plan was based on, if any - used to detect that the plan is out of date
	BasedOnHash              string                   `yaml:"basedOnHash"`
	DirectoryPath            string                   `yaml:"-"`
	ProviderPriority         []string                 `yaml:"providerPriority"`
	SkipDependencyValidation bool                     `yaml:"skipDependencyValidation"`
	ValueOverrides           values.ValueSet          `yaml:"valueOverrides"`
	AppDeploymentProgress    []*AppDeploymentProgress `yaml:"deployedApps"`
	Apps                     []*AppDeploymentPlan     `yaml:"apps"`
	BundleInfo               *BundleInfo              `yaml:"bundleInfo,omitempty"`
	DeployApps               map[string]bool          `yaml:"deployApps"`
}

func LoadDeploymentPlanFromFile

func LoadDeploymentPlanFromFile(path string) (*DeploymentPlan, error)

func (*DeploymentPlan) FindDeploymentPlanProgress

func (d *DeploymentPlan) FindDeploymentPlanProgress(app *AppManifest, stack brns.StackBrn) *AppDeploymentProgress

func (*DeploymentPlan) GetDeploymentProgressReportForStack

func (d *DeploymentPlan) GetDeploymentProgressReportForStack(env *environment.Environment, stack *kube.Stack) AddDeploymentProgressReports

func (*DeploymentPlan) RecordProgress

func (d *DeploymentPlan) RecordProgress(app *AppDeploy, stack brns.StackBrn, e error)

func (*DeploymentPlan) Save

func (d *DeploymentPlan) Save() error

func (*DeploymentPlan) SavePlanFileOnly

func (d *DeploymentPlan) SavePlanFileOnly() error

type DeploymentPlanCreator

type DeploymentPlanCreator struct {
	Platform *Platform
	Bosun    *Bosun
}

func NewDeploymentPlanCreator

func NewDeploymentPlanCreator(bosun *Bosun, platform *Platform) DeploymentPlanCreator

func (DeploymentPlanCreator) CreateDeploymentPlan

type DeploymentPlanExecutor

type DeploymentPlanExecutor struct {
	Platform *Platform
	Bosun    *Bosun
}

func NewDeploymentPlanExecutor

func NewDeploymentPlanExecutor(bosun *Bosun, platform *Platform) DeploymentPlanExecutor

func (DeploymentPlanExecutor) Execute

type E2EBookendScripts

type E2EBookendScripts struct {
	SetupScript    *script.Script `yaml:"setupScript,omitempty" json:"setupScript"`
	TeardownScript *script.Script `yaml:"teardownScript,omitempty" json:"teardownScript,omitempty"`
}

func (E2EBookendScripts) Setup

func (e E2EBookendScripts) Setup(ctx BosunContext) error

func (E2EBookendScripts) Teardown

func (e E2EBookendScripts) Teardown(ctx BosunContext) error

type E2EContext

type E2EContext struct {
	SkipSetup    bool
	SkipTeardown bool
	Tests        []string
}

func GetE2EContext

func GetE2EContext(ctx BosunContext) E2EContext

type E2EResult

type E2EResult struct {
	Name   string           `yaml:"name" json:"name"`
	Steps  []*E2EStepResult `yaml:"steps" json:"steps"`
	Passed bool             `yaml:"passed" json:"passed"`
	Error  string           `yaml:"error,omitempty" json:"error,omitempty"`
	Timed  `yaml:",inline"`
}

type E2ERun

type E2ERun struct {
	ID      string
	Ctx     BosunContext
	Suite   *E2ESuite
	Configs []*E2ETestConfig
	Tests   []*E2ETest
	Results []*E2EResult
}

func (*E2ERun) Execute

func (r *E2ERun) Execute() error

type E2EStepConfig

type E2EStepConfig struct {
	core.ConfigShared `yaml:",inline"`
}

type E2EStepResult

type E2EStepResult struct {
	Name   string `yaml:"name" json:"name"`
	Passed bool   `yaml:"passed" json:"passed"`
	Error  string `yaml:"error,omitempty" json:"error,omitempty"`
	Timed  `yaml:",inline"`
}

type E2ESuite

type E2ESuite struct {
	E2ESuiteConfig
	PreparedConnections []mongo.PreparedConnection
}

func NewE2ESuite

func NewE2ESuite(ctx BosunContext, config *E2ESuiteConfig) (*E2ESuite, error)

func (*E2ESuite) LoadTests

func (s *E2ESuite) LoadTests(ctx BosunContext) error

func (*E2ESuite) Run

func (s *E2ESuite) Run(ctx BosunContext, tests ...string) ([]*E2EResult, error)

type E2ESuiteConfig

type E2ESuiteConfig struct {
	core.ConfigShared `yaml:",inline"`
	E2EBookendScripts `yaml:",inline"`
	MongoConnections  map[string]mongo.Connection `yaml:"mongoConnections,omitempty"`
	TestFiles         []string                    `yaml:"tests"`
	Tests             []*E2ETestConfig            `yaml:"-"`
}

func (*E2ESuiteConfig) SetFromPath

func (e *E2ESuiteConfig) SetFromPath(path string)

type E2ETest

type E2ETest struct {
	E2ETestConfig
}

func NewE2ETest

func NewE2ETest(config E2ETestConfig) *E2ETest

func (*E2ETest) Execute

func (e *E2ETest) Execute(ctx BosunContext) (*E2EResult, error)

type E2ETestConfig

type E2ETestConfig struct {
	core.ConfigShared `yaml:",inline"`
	E2EBookendScripts `yaml:",inline"`
	Dependencies      []*Dependency          `yaml:"dependencies,omitempty" json:"dependencies,omitempty"`
	Variables         map[string]interface{} `yaml:"variables,omitempty" json:"variables"`
	Steps             []script.ScriptStep    `yaml:"steps,omitempty" json:"steps,omitempty"`
}

func (*E2ETestConfig) SetFromPath

func (e *E2ETestConfig) SetFromPath(path string)

type ExecuteDeploymentPlanRequest

type ExecuteDeploymentPlanRequest struct {
	Path           string
	Plan           *DeploymentPlan
	IncludeApps    []string
	ValueSets      values.ValueSets
	Recycle        bool
	Validate       bool
	ValidateOnly   bool
	DumpValuesOnly bool
	DiffOnly       bool
	UseSudo        bool
	RenderOnly     bool
}

type ExecuteDeploymentPlanResponse

type ExecuteDeploymentPlanResponse struct {
	ValidationErrors map[string]string
}

type File

type File struct {
	Imports      []string               `yaml:"imports,omitempty" json:"imports"`
	Environments []*environment.Config  `yaml:"environments,omitempty" json:"environments"`
	AppRefs      map[string]*Dependency `yaml:"appRefs,omitempty" json:"appRefs"`
	Apps         []*AppConfig           `yaml:"apps,omitempty" json:"apps"`
	Repos        []*RepoConfig          `yaml:"repos,omitempty" json:"repos"`
	FromPath     string                 `yaml:"fromPath" json:"fromPath"`
	Config       *Workspace             `yaml:"-" json:"-"`
	Tools        []*ToolDef             `yaml:"tools,omitempty" json:"tools"`
	TestSuites   []*E2ESuiteConfig      `yaml:"testSuites,omitempty" json:"testSuites,omitempty"`
	Scripts      []*script.Script       `yaml:"scripts,omitempty" json:"scripts,omitempty"`
	ValueSets    []values.ValueSet      `yaml:"valueSets,omitempty" json:"valueSets,omitempty"`
	Platforms    []*Platform            `yaml:"platforms,omitempty" json:"platforms,omitempty"`
	// contains filtered or unexported fields
}

File represents a loaded bosun.yaml file.

func LoadFile

func LoadFile(path string) (*File, error)

func (*File) GetEnvironmentConfig

func (f *File) GetEnvironmentConfig(name string) *environment.Config

func (*File) MarshalYAML

func (f *File) MarshalYAML() (interface{}, error)

func (*File) Merge

func (f *File) Merge(other *File) error

func (*File) Save

func (f *File) Save() error

func (*File) SetFromPath

func (f *File) SetFromPath(path string)

func (*File) UnmarshalYAML

func (f *File) UnmarshalYAML(unmarshal func(interface{}) error) error

type FilePathAppProvider

type FilePathAppProvider struct {
	// contains filtered or unexported fields
}

func NewFilePathAppProvider

func NewFilePathAppProvider(log *logrus.Entry) FilePathAppProvider

func (FilePathAppProvider) GetAllApps

func (a FilePathAppProvider) GetAllApps() (map[string]*App, error)

func (FilePathAppProvider) ProvideApp

func (a FilePathAppProvider) ProvideApp(req AppProviderRequest) (*App, error)

func (FilePathAppProvider) String

func (a FilePathAppProvider) String() string

type GetterConfig

type GetterConfig struct {
	URL      string            `yaml:"url" json:"url"`
	Mappings map[string]string `yaml:"mappings" json:"mappings"`
}

type HelmRelease

type HelmRelease struct {
	Name       string `yaml:"name" json:"Name"`
	Revision   string `yaml:"revision" json:"Revision"`
	Updated    string `yaml:"updated" json:"Updated"`
	Status     string `yaml:"status" json:"Status"`
	Chart      string `yaml:"chart" json:"Chart"`
	AppVersion string `yaml:"app_version" json:"AppVersion"`
	Namespace  string `yaml:"namespace" json:"Namespace"`
}

type HelmReleaseResult

type HelmReleaseResult []*HelmRelease

type Installer

type Installer struct {
	Script string        `yaml:"script,omitempty" json:"script,omitempty"`
	Getter *GetterConfig `yaml:"getter,omitempty" json:"getter,omitempty"`
}

func (Installer) Execute

func (i Installer) Execute(ctx BosunContext) error

type Logger

type Logger interface {
	Log() *logrus.Entry
}

type Plan

type Plan []PlanStep

type PlanReleaseCommitRequest

type PlanReleaseCommitRequest struct {
	Apps []string
}

type PlanStep

type PlanStep struct {
	Name        string
	Description string
	Action      func(ctx BosunContext) error
}

type Platform

type Platform struct {
	core.ConfigShared            `yaml:",inline"`
	BosunVersion                 semver.Version                   `yaml:"bosunVersion"`
	DefaultChartRepo             string                           `yaml:"defaultChartRepo"`
	Branching                    git.BranchSpec                   `yaml:"branching"`
	ReleaseBranchFormat_OBSOLETE string                           `yaml:"releaseBranchFormat,omitempty"`
	MasterBranch_OBSOLETE        string                           `yaml:"masterBranch,omitempty"`
	ReleaseDirectory             string                           `yaml:"releaseDirectory" json:"releaseDirectory"`
	AppConfigDirectory           string                           `yaml:"appConfigDirectory,omitempty"`
	EnvironmentDirectory         string                           `yaml:"environmentDirectory,omitempty" json:"environmentDirectory"`
	BundleDirectory              string                           `yaml:"bundleDirectory,omitempty" json:"bundleDirectory"`
	EnvironmentPaths             []string                         `yaml:"environmentPaths,omitempty" json:"environmentPaths"`
	ClusterPaths                 []string                         `yaml:"clusterPaths,omitempty" json:"clusterPaths"`
	EnvironmentRoles             []core.EnvironmentRoleDefinition `yaml:"environmentRoles"`
	ClusterRoles                 []core.ClusterRoleDefinition     `yaml:"clusterRoles"`
	NamespaceRoles               []core.NamespaceRoleDefinition   `yaml:"namespaceRoles"`
	ValueOverrides               *values.ValueSetCollection       `yaml:"valueOverrides,omitempty"`
	ReleaseMetadata              []*ReleaseMetadata               `yaml:"releases" json:"releases"`
	Apps                         PlatformAppConfigs               `yaml:"apps,omitempty"`
	StoryHandlers                map[string]values.Values         `yaml:"storyHandlers"`

	RepoName string `yaml:"-"`
	// contains filtered or unexported fields
}

Platform is a collection of releasable apps which work together in a single cluster. The platform contains a history of all releases created for the platform.

func (*Platform) AddAppValuesForCluster

func (p *Platform) AddAppValuesForCluster(ctx BosunContext, appName string, overridesName string, matchMap filter.MatchMapConfig) error

func (*Platform) CreateHotfix

func (p *Platform) CreateHotfix(ctx BosunContext, version semver.Version) (*ReleaseManifest, error)

func (*Platform) CreateRelease

func (p *Platform) CreateRelease(ctx BosunContext, settings ReleaseCreateSettings) (*ReleaseManifest, error)

func (*Platform) GetAppManifestByNameFromSlot

func (p *Platform) GetAppManifestByNameFromSlot(appName string, slot string) (*AppManifest, error)

func (*Platform) GetApps

func (*Platform) GetAppsAndDependencies

func (p *Platform) GetAppsAndDependencies(b *Bosun, req CreateDeploymentPlanRequest) (AppsAndDependencies, error)

func (*Platform) GetClusterByBrn

func (p *Platform) GetClusterByBrn(stack brns.StackBrn) (*kube.ClusterConfig, error)

func (*Platform) GetClusters

func (p *Platform) GetClusters() (kube.ClusterConfigs, error)

func (*Platform) GetCurrentBranch

func (p *Platform) GetCurrentBranch() (git.BranchName, error)

func (*Platform) GetCurrentRelease

func (p *Platform) GetCurrentRelease() (*ReleaseManifest, error)

func (*Platform) GetDeploymentsDir

func (p *Platform) GetDeploymentsDir() string

func (*Platform) GetEnvironmentConfigs

func (p *Platform) GetEnvironmentConfigs() ([]*environment.Config, error)

func (*Platform) GetKnownAppMap

func (p *Platform) GetKnownAppMap() map[string]*PlatformAppConfig

func (*Platform) GetManifestDirectoryPath

func (p *Platform) GetManifestDirectoryPath(name string) string

func (*Platform) GetPlatformAppUnfiltered

func (p *Platform) GetPlatformAppUnfiltered(appName string) (*PlatformAppConfig, error)

func (*Platform) GetPreviousRelease

func (p *Platform) GetPreviousRelease() (*ReleaseManifest, error)

func (*Platform) GetPreviousReleaseMetadata

func (p *Platform) GetPreviousReleaseMetadata(version semver.Version) *ReleaseMetadata

func (*Platform) GetReleaseManifestBySlot

func (p *Platform) GetReleaseManifestBySlot(slot string) (*ReleaseManifest, error)

func (*Platform) GetReleaseManifestBySlotAndBranch

func (p *Platform) GetReleaseManifestBySlotAndBranch(fromSlot string, asSlot string, branch git.BranchName) (*ReleaseManifest, error)

func (*Platform) GetReleaseMetadataByVersion

func (p *Platform) GetReleaseMetadataByVersion(v semver.Version) (*ReleaseMetadata, error)

func (*Platform) GetReleaseMetadataSortedByVersion

func (p *Platform) GetReleaseMetadataSortedByVersion(descending bool) []*ReleaseMetadata

func (*Platform) GetStableAppMetadata

func (p *Platform) GetStableAppMetadata(name string) (*AppMetadata, error)

func (*Platform) GetStableRelease

func (p *Platform) GetStableRelease() (*ReleaseManifest, error)

func (*Platform) GetUnstableRelease

func (p *Platform) GetUnstableRelease() (*ReleaseManifest, error)

func (*Platform) GetValueSetCollection

func (p *Platform) GetValueSetCollection() values.ValueSetCollection

func (*Platform) IncludeApp

func (p *Platform) IncludeApp(ctx BosunContext, config *PlatformAppConfig) error

func (*Platform) LoadChildren

func (p *Platform) LoadChildren() error

func (*Platform) MakeReleaseBranchName

func (p *Platform) MakeReleaseBranchName(version semver.Version) string

func (*Platform) MarshalYAML

func (p *Platform) MarshalYAML() (interface{}, error)

func (*Platform) MustGetReleaseManifestBySlot

func (p *Platform) MustGetReleaseManifestBySlot(name string) *ReleaseManifest

func (*Platform) MustGetStableRelease

func (p *Platform) MustGetStableRelease() *ReleaseManifest

func (*Platform) MustGetUnstableRelease

func (p *Platform) MustGetUnstableRelease() *ReleaseManifest

func (*Platform) RefreshApp

func (p *Platform) RefreshApp(ctx BosunContext, name string, branch string, slot string) error

RefreshApp checks updates the specified slot with the specified branch of the named app.

func (*Platform) Save

func (p *Platform) Save(ctx BosunContext) error

Save saves the platform. This will update the file containing the platform, and will write out any release manifests which have been loaded in this platform.

func (*Platform) SetReleaseManifest

func (p *Platform) SetReleaseManifest(slot string, manifest *ReleaseManifest)

func (*Platform) SwitchToReleaseBranch

func (p *Platform) SwitchToReleaseBranch(ctx BosunContext, branch string) error

func (*Platform) UnmarshalYAML

func (p *Platform) UnmarshalYAML(unmarshal func(interface{}) error) error

type PlatformAppConfig

type PlatformAppConfig struct {
	Name          string                `yaml:"name"`
	RepoRef       issues.RepoRef        `yaml:"repo"`
	Dependencies  []string              `yaml:"dependsOn,omitempty"`
	TargetFilters filter.MatchMapConfig `yaml:"targetFilters"`
	// The cluster roles this app should be deployed to.
	ClusterRoles core.ClusterRoles `yaml:"clusterRoles,flow"`
	// The namespace roles this app should be deployed to.
	NamespaceRoles core.NamespaceRoles        `yaml:"namespaceRoles,flow"`
	ValueOverrides *values.ValueSetCollection `yaml:"valueOverrides,omitempty"`
}

PlatformAppConfig is the config unit for referencing an app from a platform and specifying the deployment settings for the app.

func (*PlatformAppConfig) GetValueSetCollection

func (e *PlatformAppConfig) GetValueSetCollection() values.ValueSetCollection

type PlatformAppConfigs

type PlatformAppConfigs []*PlatformAppConfig

func (PlatformAppConfigs) FilterByEnvironment

func (p PlatformAppConfigs) FilterByEnvironment(env *environment.Environment) PlatformAppConfigs

func (PlatformAppConfigs) Names

func (p PlatformAppConfigs) Names() []string

type PlatformBundler

type PlatformBundler struct {
	// contains filtered or unexported fields
}

func NewPlatformBundler

func NewPlatformBundler(bosun *Bosun, platform *Platform) PlatformBundler

func (PlatformBundler) Execute

type PlatformPushRequest

type PlatformPushRequest struct {
	BundleDir       string
	ManifestDir     string
	PushAllApps     bool
	PushApp         string
	EnvironmentPath string
	Cluster         string
}

type PlatformPusher

type PlatformPusher struct {
	// contains filtered or unexported fields
}

func NewPlatformPusher

func NewPlatformPusher(bosun *Bosun, platform *Platform) PlatformPusher

func (*PlatformPusher) Push

type ProjectManagementPlugin

type ProjectManagementPlugin struct {
	Name string `yaml:"name" json:"name"`
}

type PublishImagesRequest

type PublishImagesRequest struct {
	App     *App
	Pattern string
}

type ReleaseCommitBumpAction

type ReleaseCommitBumpAction struct {
	Version semver.Version `yaml:"version,omitempty"`
	Branch  string         `yaml:"branch"`
}

func (ReleaseCommitBumpAction) String

func (a ReleaseCommitBumpAction) String() string

type ReleaseCommitMergeAction

type ReleaseCommitMergeAction struct {
	ToBranch   string `yaml:"targetBranch"`
	FromBranch string `yaml:"fromBranch"`
}

func (ReleaseCommitMergeAction) String

func (a ReleaseCommitMergeAction) String() string

type ReleaseCommitTagAction

type ReleaseCommitTagAction struct {
	Branch string   `yaml:"branch"`
	Tags   []string `yaml:"tags"`
}

func (ReleaseCommitTagAction) String

func (a ReleaseCommitTagAction) String() string

type ReleaseCommitter

type ReleaseCommitter struct {
	// contains filtered or unexported fields
}

func NewReleaseCommitter

func NewReleaseCommitter(platform *Platform, b *Bosun) (*ReleaseCommitter, error)

func (*ReleaseCommitter) Execute

func (r *ReleaseCommitter) Execute() error

func (*ReleaseCommitter) ExecuteStep

func (r *ReleaseCommitter) ExecuteStep(i int, step ReleaseCommitterPlanStep) error

func (*ReleaseCommitter) GetPlan

func (*ReleaseCommitter) Plan

type ReleaseCommitterPlan

type ReleaseCommitterPlan struct {
	ReleaseVersion semver.Version             `yaml:"releaseVersion"`
	Steps          []ReleaseCommitterPlanStep `yaml:"steps"`
}

func (ReleaseCommitterPlan) Headers

func (r ReleaseCommitterPlan) Headers() []string

func (ReleaseCommitterPlan) Rows

func (r ReleaseCommitterPlan) Rows() [][]string

type ReleaseCommitterPlanStep

type ReleaseCommitterPlanStep struct {
	CompletedAt time.Time                 `yaml:"completed,omitempty"`
	Error       string                    `yaml:"error,omitempty"`
	Repo        issues.RepoRef            `yaml:"repo"`
	RepoPath    string                    `yaml:"repoPath"`
	App         string                    `yaml:"app,omitempty"`
	Description string                    `yaml:"description"`
	Bump        *ReleaseCommitBumpAction  `yaml:"bump,omitempty"`
	Merge       *ReleaseCommitMergeAction `yaml:"merge,omitempty"`
	Tag         *ReleaseCommitTagAction   `yaml:"tag,omitempty"`
}

func (ReleaseCommitterPlanStep) String

func (r ReleaseCommitterPlanStep) String() string

type ReleaseCreateSettings

type ReleaseCreateSettings struct {
	Version     semver.Version
	Base        *semver.Version
	Description string
}

type ReleaseManifest

type ReleaseManifest struct {
	*ReleaseMetadata `yaml:"metadata"`
	AppMetadata      map[string]*AppMetadata    `yaml:"apps"`
	ValueSets        *values.ValueSetCollection `yaml:"valueSets,omitempty"`
	Platform         *Platform                  `yaml:"-"`

	Slot string `yaml:"-"`
	// contains filtered or unexported fields
}

ReleaseManifest represents a release for a platform. Instances should be manipulated using methods on the platform, not updated directly.

func NewReleaseManifest

func NewReleaseManifest(metadata *ReleaseMetadata) *ReleaseManifest

func (*ReleaseManifest) AddOrReplaceApp

func (r *ReleaseManifest) AddOrReplaceApp(manifest *AppManifest, addToDefaultDeploys bool) error

func (*ReleaseManifest) BumpForRelease

func (r *ReleaseManifest) BumpForRelease(ctx BosunContext, app *App, fromBranch, toBranch string, bump semver.Bump, expectedVersion semver.Version) (*App, error)

BumpForRelease upgrades the named app by creating a release branch and bumping the version in that branch based on the bump parameter (if the app's current version is expectedVersion). If the bump parameter is "none" then the app won't be bumped.

func (*ReleaseManifest) Clone

func (r *ReleaseManifest) Clone() *ReleaseManifest

func (*ReleaseManifest) ExportDiagram

func (r *ReleaseManifest) ExportDiagram() (string, error)

func (*ReleaseManifest) GetAllAppMetadata

func (r *ReleaseManifest) GetAllAppMetadata() map[string]*AppMetadata

func (*ReleaseManifest) GetAppManifest

func (r *ReleaseManifest) GetAppManifest(name string) (*AppManifest, error)

func (*ReleaseManifest) GetAppManifests

func (r *ReleaseManifest) GetAppManifests() (map[string]*AppManifest, error)

func (*ReleaseManifest) GetAppManifestsPinnedToRelease

func (r *ReleaseManifest) GetAppManifestsPinnedToRelease() (map[string]*AppManifest, error)

func (*ReleaseManifest) GetChangeDetectionHash

func (r *ReleaseManifest) GetChangeDetectionHash() (string, error)

func (*ReleaseManifest) Headers

func (r *ReleaseManifest) Headers() []string

func (*ReleaseManifest) IsMutable

func (r *ReleaseManifest) IsMutable() error

func (*ReleaseManifest) MarkDeleted

func (r *ReleaseManifest) MarkDeleted() *ReleaseManifest

func (*ReleaseManifest) MarkDirty

func (r *ReleaseManifest) MarkDirty() *ReleaseManifest

func (*ReleaseManifest) MarshalYAML

func (r *ReleaseManifest) MarshalYAML() (interface{}, error)

func (*ReleaseManifest) PrepareAppForRelease

func (r *ReleaseManifest) PrepareAppForRelease(ctx BosunContext, app *App, bump semver.Bump, branch string) (*AppManifest, error)

func (*ReleaseManifest) RefreshApp

func (r *ReleaseManifest) RefreshApp(ctx BosunContext, name string, branch string) error

func (*ReleaseManifest) RefreshApps

func (r *ReleaseManifest) RefreshApps(ctx BosunContext, apps ...*App) error

func (*ReleaseManifest) RemoveApp

func (r *ReleaseManifest) RemoveApp(appName string)

func (*ReleaseManifest) Rows

func (r *ReleaseManifest) Rows() [][]string

func (*ReleaseManifest) Save

func (r *ReleaseManifest) Save(ctx BosunContext) error

func (*ReleaseManifest) SyncApp

func (r *ReleaseManifest) SyncApp(ctx BosunContext, name string) error

SyncApp refreshes the app's manifest from the release branch of that app.

func (*ReleaseManifest) TryGetAppManifest

func (r *ReleaseManifest) TryGetAppManifest(name string) (*AppManifest, bool, error)

func (*ReleaseManifest) UnmarshalYAML

func (r *ReleaseManifest) UnmarshalYAML(unmarshal func(interface{}) error) error

type ReleaseManifestAppProvider

type ReleaseManifestAppProvider struct {
	// contains filtered or unexported fields
}

func NewReleaseManifestAppProvider

func NewReleaseManifestAppProvider(release *ReleaseManifest) ReleaseManifestAppProvider

func (ReleaseManifestAppProvider) GetAllApps

func (a ReleaseManifestAppProvider) GetAllApps() (map[string]*App, error)

func (ReleaseManifestAppProvider) ProvideApp

func (ReleaseManifestAppProvider) String

type ReleaseMetadata

type ReleaseMetadata struct {
	Version     semver.Version `yaml:"version"`
	Branch      string         `yaml:"branch"`
	Description string         `yaml:"description"`
}

func (*ReleaseMetadata) GetBranchParts

func (r *ReleaseMetadata) GetBranchParts() git.BranchParts

func (ReleaseMetadata) GetReleaseBranchName

func (r ReleaseMetadata) GetReleaseBranchName(branchSpec git.BranchSpec) (string, error)

func (ReleaseMetadata) String

func (r ReleaseMetadata) String() string

type Repo

type Repo struct {
	RepoConfig
	LocalRepo *vcs.LocalRepo
	Apps      map[string]*AppConfig
}

func (*Repo) CheckCloned

func (r *Repo) CheckCloned() error

func (*Repo) Clone

func (r *Repo) Clone(ctx BosunContext, toDir string) error

func (*Repo) Fetch

func (r *Repo) Fetch() error

func (Repo) GetLabels

func (r Repo) GetLabels() filter.Labels

func (Repo) GetLocalBranchName

func (r Repo) GetLocalBranchName() git.BranchName

func (*Repo) GetRef

func (r *Repo) GetRef() (issues.RepoRef, error)

func (*Repo) Merge

func (r *Repo) Merge(fromBranch, toBranch string) error

func (*Repo) Pull

func (r *Repo) Pull(ctx BosunContext, rebase bool) error

type RepoConfig

type RepoConfig struct {
	core.ConfigShared `yaml:",inline"`
	Branching         git.BranchSpec
	FilteringLabels   map[string]string `yaml:"labels" json:"labels"`
}

type RepoFile

type RepoFile struct {
	File       `yaml:",inline"`
	Name       string         `yaml:"name"`
	APIVersion string         `yaml:"apiVersion,omitempty"`
	Branching  git.BranchSpec `yaml:"branching,omitempty"`
}

func (*RepoFile) MarshalYAML

func (f *RepoFile) MarshalYAML() (interface{}, error)

func (*RepoFile) UnmarshalYAML

func (f *RepoFile) UnmarshalYAML(unmarshal func(interface{}) error) error

type RepoInfo

type RepoInfo struct {
	App     string `yaml:"app" json:"app"`
	Name    string `yaml:"name" json:"name"`
	Path    string `yaml:"path" json:"path"`
	IsDirty bool   `yaml:"isDirty" json:"isDirty"`
	Branch  string `yaml:"Branch" json:"branch"`
}

type Services

type Services struct {
	// contains filtered or unexported fields
}

Services is version 2 of the BosunContext. It's intended to implement contracts defined in contracts.go, to make it easier for various components to declare their actual dependencies rather than taking a dependency on the entire concrete BosunContext.

func (Services) Log

func (s Services) Log() *logrus.Entry

type SharedDeploySettings

type SharedDeploySettings struct {
	Environment     *environment.Environment
	DumpValuesOnly  bool
	UseLocalContent bool
	Recycle         bool
	DiffOnly        bool
	RenderOnly      bool
}

SharedDeploySettings are copied from the DeploySettings to the AppDeploySettings

type State

type State struct {
	Microservices map[string]workspace.AppState
}

type StatusDiff

type StatusDiff struct {
	From string
	To   string
}

type StoryHandlers

type StoryHandlers map[string]values.Values

func (*StoryHandlers) UnmarshalYAML

func (s *StoryHandlers) UnmarshalYAML(unmarshal func(interface{}) error) error

type TemplateBosunValues

type TemplateBosunValues struct {
	AppName         string   `yaml:"appName"`
	AppVersion      string   `yaml:"appVersion"`
	Cluster         string   `yaml:"cluster"`
	Stack           string   `yaml:"stack"`
	ClusterRoles    []string `yaml:"clusterRoles"`
	ClusterProvider string   `yaml:"clusterProvider"`
	Namespace       string   `yaml:"namespace"`
	NamespaceRole   string   `yaml:"namespaceRole"`
	NamespaceRoles  []string `yaml:"namespaceRoles"`
	Environment     string   `yaml:"environment"`
	EnvironmentRole string   `yaml:"environmentRole"`
	ReleaseVersion  string   `yaml:"releaseVersion"`
	DeployedAt      string   `yaml:"deployedAt"`
}

func (TemplateBosunValues) ToValues

func (t TemplateBosunValues) ToValues() values.Values

type Timed

type Timed struct {
	StartedAt time.Time `yaml:"startedAt" json:"startedAt"`
	EndedAt   time.Time `yaml:"endedAt" json:"endedAt"`
	Elapsed   string    `yaml:"elapsed" json:"elapsed"`
}

func (*Timed) StartTimer

func (t *Timed) StartTimer()

func (*Timed) StopTimer

func (t *Timed) StopTimer()

type ToolDef

type ToolDef struct {
	FromPath    string               `yaml:"-" json:"-"`
	Name        string               `yaml:"name" json:"name"`
	Description string               `yaml:"description" json:"description"`
	URL         string               `yaml:"url,omitempty" json:"url,omitempty"`
	Cmd         map[string]string    `yaml:"cmd,omitempty" json:"cmd,omitempty"`
	Installer   map[string]Installer `yaml:"installer,omitempty" json:"installer,omitempty"`
}

func (ToolDef) GetExecutable

func (t ToolDef) GetExecutable() (string, error)

func (ToolDef) GetInstaller

func (t ToolDef) GetInstaller() (*Installer, error)

func (ToolDef) RunInstall

func (t ToolDef) RunInstall(ctx BosunContext) error

type ToolDefs

type ToolDefs []*ToolDef

func (ToolDefs) Len

func (t ToolDefs) Len() int

func (ToolDefs) Less

func (t ToolDefs) Less(i, j int) bool

func (ToolDefs) Swap

func (t ToolDefs) Swap(i, j int)

type Workspace

type Workspace struct {
	Path                   string `yaml:"-" json:"-"`
	workspace.Context      `yaml:",inline"`
	Imports                []string                         `yaml:"imports,omitempty" json:"imports"`
	Parameters             cli.Parameters                   `yaml:"parameters" json:"parameters"`
	GitRoots               []string                         `yaml:"gitRoots" json:"gitRoots"`
	BuildServer            bool                             `yaml:"buildServer" json:"buildServer"`
	GithubToken            *command.CommandValue            `yaml:"githubToken" json:"githubToken"`
	ScratchDir             string                           `yaml:"scratchDir" json:"scratchDir"`
	WorkspaceCommands      map[string]*command.CommandValue `yaml:"workspaceCommands"`
	HostIPInMinikube       string                           `yaml:"hostIPInMinikube" json:"hostIpInMinikube"`
	ClonePaths             map[string]string                `yaml:"clonePaths,omitempty" json:"clonePaths,omitempty"`
	MergedBosunFile        *File                            `yaml:"-" json:"merged"`
	ImportedBosunFiles     map[string]*File                 `yaml:"-" json:"imported"`
	Minikube               *kube.MinikubeConfig             `yaml:"minikube,omitempty" json:"minikube,omitempty"`
	LocalRepos             map[string]*vcs.LocalRepo        `yaml:"localRepos" json:"localRepos"`
	GithubCloneProtocol    string                           `yaml:"githubCloneProtocol"`
	StoryHandlers          StoryHandlers                    `yaml:"storyHandlers"`
	ClusterKubeconfigPaths map[string]string                `yaml:"clusterKubeconfigPaths"`
	AppHints               []apps.AppHint                   `yaml:"appHints"`
}

func LoadWorkspace

func LoadWorkspace(path string) (*Workspace, error)

func LoadWorkspaceNoImports

func LoadWorkspaceNoImports(path string) (*Workspace, error)

func LoadWorkspaceWithStaticImports

func LoadWorkspaceWithStaticImports(path string, imports []string) (*Workspace, error)

func (*Workspace) GetWorkspaceCommand

func (w *Workspace) GetWorkspaceCommand(key string, hint string) *command.CommandValue

func (*Workspace) Save

func (w *Workspace) Save() error

func (*Workspace) UnmarshalYAML

func (w *Workspace) UnmarshalYAML(unmarshal func(interface{}) error) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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