Documentation ¶
Index ¶
- Variables
- func GaugeEnvAppLockMetric(fs billy.Filesystem, env, app string)
- func GaugeEnvLockMetric(fs billy.Filesystem, env string)
- func GetEnvironmentApplicationLocksCount(fs billy.Filesystem, environment, application string) float64
- func GetEnvironmentLocksCount(fs billy.Filesystem, env string) float64
- func GetLastRelease(fs billy.Filesystem, application string) (uint64, error)
- func GetRepositoryStateAndUpdateMetrics(repo Repository)
- func GetTags(cfg RepositoryConfig, repoName string, ctx context.Context) (tags []*api.TagData, err error)
- func RegularlySendDatadogMetrics(repo Repository, interval time.Duration, callBack func(repository Repository))
- func UpdateDatadogMetrics(state *State, changes *TransformerResult) error
- func WithTimeNow(ctx context.Context, t time.Time) context.Context
- type Actor
- type AppEnv
- type ArgoWebhookData
- type Authentication
- type Certificates
- type CleanupOldApplicationVersions
- type CommitIds
- type CreateApplicationVersion
- type CreateEnvironment
- type CreateEnvironmentApplicationLock
- type CreateEnvironmentGroupLock
- type CreateEnvironmentLock
- type CreateReleaseError
- func GetCreateReleaseAlreadyExistsDifferent(firstDifferingField api.DifferingField, diff string) *CreateReleaseError
- func GetCreateReleaseAlreadyExistsSame() *CreateReleaseError
- func GetCreateReleaseAppNameTooLong(appName string, regExp string, maxLen uint32) *CreateReleaseError
- func GetCreateReleaseGeneralFailure(err error) *CreateReleaseError
- func GetCreateReleaseTooOld() *CreateReleaseError
- type CreateUndeployApplicationVersion
- type Credentials
- type DeleteEnvFromApp
- type DeleteEnvironmentApplicationLock
- type DeleteEnvironmentGroupLock
- type DeleteEnvironmentLock
- type DeployApplicationVersion
- type InternalError
- type Lock
- type LockedError
- type ObjectCount
- type PushActionCallbackFunc
- type PushActionFunc
- type PushUpdateFunc
- type QueueApplicationVersion
- type RawNode
- type Release
- type ReleaseTrain
- type Repository
- type RepositoryConfig
- type RootApp
- type State
- func (s *State) DeleteAppLockIfEmpty(ctx context.Context, environment string, application string) error
- func (s *State) DeleteDirIfEmpty(directoryName string) (SuccessReason, error)
- func (s *State) DeleteEnvLockIfEmpty(ctx context.Context, environment string) error
- func (s *State) DeleteQueuedVersion(environment string, application string) error
- func (s *State) DeleteQueuedVersionIfExists(environment string, application string) error
- func (s *State) GetAppLocksDir(environment string, application string) string
- func (s *State) GetApplicationRelease(application string, version uint64) (*Release, error)
- func (s *State) GetApplicationReleases(application string) ([]uint64, error)
- func (s *State) GetApplicationSourceRepoUrl(application string) (string, error)
- func (s *State) GetApplicationTeamOwner(application string) (string, error)
- func (s *State) GetApplications() ([]string, error)
- func (s *State) GetDeploymentMetaData(ctx context.Context, environment, application string) (string, time.Time, error)
- func (s *State) GetEnvLockDir(environment string, lockId string) string
- func (s *State) GetEnvLocksDir(environment string) string
- func (s *State) GetEnvironmentApplicationLocks(environment, application string) (map[string]Lock, error)
- func (s *State) GetEnvironmentApplicationVersion(environment, application string) (*uint64, error)
- func (s *State) GetEnvironmentApplications(environment string) ([]string, error)
- func (s *State) GetEnvironmentConfigs() (map[string]config.EnvironmentConfig, error)
- func (s *State) GetEnvironmentConfigsAndValidate(ctx context.Context) (map[string]config.EnvironmentConfig, error)
- func (s *State) GetEnvironmentConfigsForGroup(envGroup string) ([]string, error)
- func (s *State) GetEnvironmentLocks(environment string) (map[string]Lock, error)
- func (s *State) GetQueuedVersion(environment string, application string) (*uint64, error)
- func (s *State) IsUndeployVersion(application string, version uint64) (bool, error)
- func (s *State) ProcessQueue(ctx context.Context, fs billy.Filesystem, environment string, ...) (string, error)
- func (s *State) ReleaseManifests(application string, release uint64) (map[string]string, error)
- func (s *State) Releases(application string) ([]uint64, error)
- type StorageBackend
- type SuccessReason
- type Transformer
- type TransformerFunc
- type TransformerResult
- type UndeployApplication
Constants ¶
This section is empty.
Variables ¶
View Source
var InvalidJson = errors.New("JSON file is not valid")
Functions ¶
func GaugeEnvAppLockMetric ¶ added in v1.16.0
func GaugeEnvAppLockMetric(fs billy.Filesystem, env, app string)
func GaugeEnvLockMetric ¶ added in v1.16.0
func GaugeEnvLockMetric(fs billy.Filesystem, env string)
func GetEnvironmentApplicationLocksCount ¶ added in v1.16.0
func GetEnvironmentApplicationLocksCount(fs billy.Filesystem, environment, application string) float64
func GetEnvironmentLocksCount ¶ added in v1.16.0
func GetEnvironmentLocksCount(fs billy.Filesystem, env string) float64
func GetLastRelease ¶
func GetLastRelease(fs billy.Filesystem, application string) (uint64, error)
func GetRepositoryStateAndUpdateMetrics ¶ added in v1.16.0
func GetRepositoryStateAndUpdateMetrics(repo Repository)
func RegularlySendDatadogMetrics ¶ added in v1.16.0
func RegularlySendDatadogMetrics(repo Repository, interval time.Duration, callBack func(repository Repository))
func UpdateDatadogMetrics ¶ added in v1.16.0
func UpdateDatadogMetrics(state *State, changes *TransformerResult) error
Types ¶
type ArgoWebhookData ¶ added in v1.16.0
type ArgoWebhookData struct { Commits []commit // contains filtered or unexported fields }
type Authentication ¶ added in v1.16.0
type Authentication struct {
RBACConfig auth.RBACConfig
}
type Certificates ¶
type Certificates struct {
KnownHostsFile string
}
type CleanupOldApplicationVersions ¶
type CleanupOldApplicationVersions struct {
Application string
}
func (*CleanupOldApplicationVersions) Transform ¶
func (c *CleanupOldApplicationVersions) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
type CreateApplicationVersion ¶
type CreateApplicationVersion struct { Authentication Version uint64 Application string Manifests map[string]string SourceCommitId string SourceAuthor string SourceMessage string SourceRepoUrl string Team string DisplayVersion string }
func (*CreateApplicationVersion) Transform ¶
func (c *CreateApplicationVersion) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
type CreateEnvironment ¶
type CreateEnvironment struct { Authentication Environment string Config config.EnvironmentConfig }
func (*CreateEnvironment) Transform ¶
func (c *CreateEnvironment) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
type CreateEnvironmentApplicationLock ¶
type CreateEnvironmentApplicationLock struct { Authentication Environment string Application string LockId string Message string }
func (*CreateEnvironmentApplicationLock) Transform ¶
func (c *CreateEnvironmentApplicationLock) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
type CreateEnvironmentGroupLock ¶ added in v1.16.0
type CreateEnvironmentGroupLock struct { Authentication EnvironmentGroup string LockId string Message string }
func (*CreateEnvironmentGroupLock) Transform ¶ added in v1.16.0
func (c *CreateEnvironmentGroupLock) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
type CreateEnvironmentLock ¶
type CreateEnvironmentLock struct { Authentication Environment string LockId string Message string }
func (*CreateEnvironmentLock) Transform ¶
func (c *CreateEnvironmentLock) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
type CreateReleaseError ¶ added in v1.19.1
type CreateReleaseError struct {
// contains filtered or unexported fields
}
func GetCreateReleaseAlreadyExistsDifferent ¶ added in v1.19.1
func GetCreateReleaseAlreadyExistsDifferent(firstDifferingField api.DifferingField, diff string) *CreateReleaseError
func GetCreateReleaseAlreadyExistsSame ¶ added in v1.19.1
func GetCreateReleaseAlreadyExistsSame() *CreateReleaseError
func GetCreateReleaseAppNameTooLong ¶ added in v1.19.1
func GetCreateReleaseAppNameTooLong(appName string, regExp string, maxLen uint32) *CreateReleaseError
func GetCreateReleaseGeneralFailure ¶ added in v1.19.1
func GetCreateReleaseGeneralFailure(err error) *CreateReleaseError
func GetCreateReleaseTooOld ¶ added in v1.19.1
func GetCreateReleaseTooOld() *CreateReleaseError
func (*CreateReleaseError) Error ¶ added in v1.19.1
func (e *CreateReleaseError) Error() string
func (*CreateReleaseError) Response ¶ added in v1.19.1
func (e *CreateReleaseError) Response() *api.CreateReleaseResponse
type CreateUndeployApplicationVersion ¶
type CreateUndeployApplicationVersion struct { Authentication Application string }
func (*CreateUndeployApplicationVersion) Transform ¶
func (c *CreateUndeployApplicationVersion) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
type Credentials ¶
type Credentials struct {
SshKey string
}
type DeleteEnvFromApp ¶ added in v1.16.0
type DeleteEnvFromApp struct { Authentication Application string Environment string }
func (*DeleteEnvFromApp) Transform ¶ added in v1.16.0
func (u *DeleteEnvFromApp) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
type DeleteEnvironmentApplicationLock ¶
type DeleteEnvironmentApplicationLock struct { Authentication Environment string Application string LockId string }
func (*DeleteEnvironmentApplicationLock) Transform ¶
func (c *DeleteEnvironmentApplicationLock) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
type DeleteEnvironmentGroupLock ¶ added in v1.16.0
type DeleteEnvironmentGroupLock struct { Authentication EnvironmentGroup string LockId string }
func (*DeleteEnvironmentGroupLock) Transform ¶ added in v1.16.0
func (c *DeleteEnvironmentGroupLock) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
type DeleteEnvironmentLock ¶
type DeleteEnvironmentLock struct { Authentication Environment string LockId string }
func (*DeleteEnvironmentLock) Transform ¶
func (c *DeleteEnvironmentLock) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
type DeployApplicationVersion ¶
type DeployApplicationVersion struct { Authentication Environment string Application string Version uint64 LockBehaviour api.LockBehavior }
func (*DeployApplicationVersion) Transform ¶
func (c *DeployApplicationVersion) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
type InternalError ¶
type InternalError struct {
// contains filtered or unexported fields
}
func (*InternalError) Error ¶
func (i *InternalError) Error() string
func (*InternalError) String ¶
func (i *InternalError) String() string
func (*InternalError) Unwrap ¶
func (i *InternalError) Unwrap() error
type LockedError ¶
type LockedError struct { EnvironmentApplicationLocks map[string]Lock EnvironmentLocks map[string]Lock }
func (*LockedError) Error ¶
func (l *LockedError) Error() string
func (*LockedError) String ¶
func (l *LockedError) String() string
type ObjectCount ¶
type PushActionCallbackFunc ¶ added in v1.16.0
type PushActionCallbackFunc func(git.PushOptions, *repository) PushActionFunc
type PushActionFunc ¶ added in v1.16.0
type PushActionFunc func() error
func DefaultPushActionCallback ¶ added in v1.16.0
func DefaultPushActionCallback(pushOptions git.PushOptions, r *repository) PushActionFunc
DefaultPushActionCallback is public for testing reasons only.
type PushUpdateFunc ¶ added in v1.16.0
type PushUpdateFunc func(string, *bool) git.PushUpdateReferenceCallback
type QueueApplicationVersion ¶
func (*QueueApplicationVersion) Transform ¶
func (c *QueueApplicationVersion) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
type Release ¶
type Release struct { Version uint64 /** "UndeployVersion=true" means that this version is empty, and has no manifest that could be deployed. It is intended to help cleanup old services within the normal release cycle (e.g. dev->staging->production). */ UndeployVersion bool SourceAuthor string SourceCommitId string SourceMessage string CreatedAt time.Time DisplayVersion string }
type ReleaseTrain ¶
type ReleaseTrain struct { Authentication Target string Team string }
func (*ReleaseTrain) Transform ¶
func (c *ReleaseTrain) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
type Repository ¶
type Repository interface { Apply(ctx context.Context, transformers ...Transformer) error Push(ctx context.Context, pushAction func() error) error ApplyTransformersInternal(ctx context.Context, transformers ...Transformer) ([]string, *State, []*TransformerResult, error) State() *State StateAt(oid *git.Oid) (*State, error) Notify() *notify.Notify }
A Repository provides a multiple reader / single writer access to a git repository.
func New ¶
func New(ctx context.Context, cfg RepositoryConfig) (Repository, error)
Opens a repository. The repository is initialized and updated in the background.
func New2 ¶ added in v1.16.0
func New2(ctx context.Context, cfg RepositoryConfig) (Repository, setup.BackgroundFunc, error)
type RepositoryConfig ¶ added in v1.16.0
type RepositoryConfig struct { // Mandatory Config // the URL used for git checkout, (ssh protocol) URL string Path string // Optional Config Credentials Credentials Certificates Certificates CommitterEmail string CommitterName string // default branch is master Branch string // network timeout NetworkTimeout time.Duration // GcFrequency uint StorageBackend StorageBackend // Bootstrap mode controls where configurations are read from // true: read from json file at EnvironmentConfigsPath // false: read from config files in manifest repo BootstrapMode bool EnvironmentConfigsPath string ArgoInsecure bool // if set, kuberpult will generate push events to argoCd whenever it writes to the manifest repo: ArgoWebhookUrl string // the url to the git repo, like the browser requires it (https protocol) WebURL string DogstatsdEvents bool }
type State ¶
type State struct { Filesystem billy.Filesystem Commit *git.Commit BootstrapMode bool EnvironmentConfigsPath string }
func (*State) DeleteAppLockIfEmpty ¶ added in v1.16.0
func (*State) DeleteDirIfEmpty ¶ added in v1.16.0
func (s *State) DeleteDirIfEmpty(directoryName string) (SuccessReason, error)
DeleteDirIfEmpty if it's empty. If the dir does not exist or is not empty, nothing happens. Errors are only returned if the read or delete operations fail. Returns SuccessReason for unit testing.
func (*State) DeleteEnvLockIfEmpty ¶ added in v1.16.0
func (*State) DeleteQueuedVersion ¶
func (*State) DeleteQueuedVersionIfExists ¶
func (*State) GetAppLocksDir ¶ added in v1.16.0
func (*State) GetApplicationRelease ¶
func (*State) GetApplicationReleases ¶
func (*State) GetApplicationSourceRepoUrl ¶ added in v1.16.0
func (*State) GetApplicationTeamOwner ¶ added in v1.16.0
func (*State) GetApplications ¶
func (*State) GetDeploymentMetaData ¶ added in v1.16.0
func (*State) GetEnvLockDir ¶ added in v1.16.0
func (*State) GetEnvLocksDir ¶ added in v1.16.0
func (*State) GetEnvironmentApplicationLocks ¶
func (*State) GetEnvironmentApplicationVersion ¶
func (*State) GetEnvironmentApplications ¶
func (*State) GetEnvironmentConfigs ¶
func (s *State) GetEnvironmentConfigs() (map[string]config.EnvironmentConfig, error)
func (*State) GetEnvironmentConfigsAndValidate ¶ added in v1.16.0
func (*State) GetEnvironmentConfigsForGroup ¶ added in v1.16.0
func (*State) GetEnvironmentLocks ¶
func (*State) GetQueuedVersion ¶
func (*State) IsUndeployVersion ¶
func (*State) ProcessQueue ¶
func (s *State) ProcessQueue(ctx context.Context, fs billy.Filesystem, environment string, application string) (string, error)
ProcessQueue checks if there is something in the queue deploys if necessary deletes the queue
func (*State) ReleaseManifests ¶
type StorageBackend ¶ added in v1.16.0
type StorageBackend int
const ( DefaultBackend StorageBackend = 0 GitBackend StorageBackend = iota SqliteBackend StorageBackend = iota )
type SuccessReason ¶ added in v1.16.0
type SuccessReason int64
const ( NoReason SuccessReason = iota DirDoesNotExist DirNotEmpty )
type Transformer ¶
type Transformer interface {
Transform(context.Context, *State) (commitMsg string, changes *TransformerResult, e error)
}
A Transformer updates the files in the worktree
type TransformerFunc ¶
func (TransformerFunc) Transform ¶
func (t TransformerFunc) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
type TransformerResult ¶ added in v1.16.0
func CombineArray ¶ added in v1.16.0
func CombineArray(others []*TransformerResult) *TransformerResult
func (*TransformerResult) AddAppEnv ¶ added in v1.16.0
func (r *TransformerResult) AddAppEnv(app string, env string, team string)
func (*TransformerResult) AddRootApp ¶ added in v1.16.0
func (r *TransformerResult) AddRootApp(env string)
func (*TransformerResult) Combine ¶ added in v1.16.0
func (r *TransformerResult) Combine(other *TransformerResult)
type UndeployApplication ¶ added in v1.16.0
type UndeployApplication struct { Authentication Application string }
func (*UndeployApplication) Transform ¶ added in v1.16.0
func (u *UndeployApplication) Transform(ctx context.Context, state *State) (string, *TransformerResult, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.