Documentation ¶
Index ¶
- Constants
- Variables
- func DeploymentDoesNotExistError(deploymentName string) error
- func DeploymentPathResolveError(stage, deploymentPath, deploymentName string) error
- func MissingDeploymentStateError() error
- func StatusTransitionAllowed(s1, s2 StatusCode) bool
- func ToScriptEnvironment(d *DeploymentState, metadata *core.ReleaseMetadata, stage string, ...) (*script.ScriptEnvironment, error)
- func ToScriptEnvironmentForDependencyStep(d *DeploymentState, metadata *core.ReleaseMetadata, stage string, ...) (*script.ScriptEnvironment, error)
- func VisitDAGNode(node *DAGNode, seen map[*DAGNode]bool, result *struct{ Order []*DAGNode })
- type Backend
- type DAG
- type DAGNode
- type DependencyResolver
- type DeploymentResolver
- type DeploymentState
- func (d *DeploymentState) CommitVersion(stage string, metadata *core.ReleaseMetadata) error
- func (d *DeploymentState) ConfigureProviders(metadata *core.ReleaseMetadata, stage string, extraProviders map[string]string) error
- func (d *DeploymentState) GetCalculatedInputs(stage string) map[string]interface{}
- func (d *DeploymentState) GetCalculatedOutputs(stage string) map[string]interface{}
- func (d *DeploymentState) GetDeployment(stage, deploymentName string) (*DeploymentState, error)
- func (d *DeploymentState) GetDeploymentOrMakeNew(stage, deploymentName string) (*DeploymentState, error)
- func (d *DeploymentState) GetDeploymentPath() string
- func (d *DeploymentState) GetEnvironmentState() *EnvironmentState
- func (d *DeploymentState) GetName() string
- func (d *DeploymentState) GetPreStepInputs(stage string) map[string]interface{}
- func (d *DeploymentState) GetProviders(stage string) map[string]string
- func (d *DeploymentState) GetReleaseId(stage string) string
- func (d *DeploymentState) GetReleaseMetadata(stage string, resolver DependencyResolver) (*core.ReleaseMetadata, error)
- func (d *DeploymentState) GetRootDeploymentName() string
- func (d *DeploymentState) GetRootDeploymentStage() string
- func (d *DeploymentState) GetStageOrCreateNew(stage string) *StageState
- func (d *DeploymentState) GetStatus(stage string) *Status
- func (d *DeploymentState) GetUserInputs(stage string) map[string]interface{}
- func (d *DeploymentState) GetVersion(stage string) string
- func (d *DeploymentState) IsDeployed(stage string, metadata *core.ReleaseMetadata) bool
- func (d *DeploymentState) Save() error
- func (d *DeploymentState) SetFailureStatus(stage string, err error, statusCode StatusCode) error
- func (d *DeploymentState) SetProvider(stage, name, deplName string)
- func (d *DeploymentState) Summarize() *DeploymentState
- func (p *DeploymentState) ToJson() string
- func (d *DeploymentState) UpdateInputs(stage string, inputs map[string]interface{}) error
- func (d *DeploymentState) UpdateOutputs(stage string, outputs map[string]interface{}) error
- func (d *DeploymentState) UpdateStatus(stage string, status *Status) error
- func (d *DeploymentState) UpdateUserInputs(stage string, inputs map[string]interface{}) error
- func (d *DeploymentState) ValidateNames() error
- type EnvironmentState
- func (e *EnvironmentState) DeleteDeployment(deploymentName string) error
- func (e *EnvironmentState) GetDeploymentStateDAG(stage string) (DAG, error)
- func (e *EnvironmentState) GetDeploymentStateTopologicalSort(stage string) ([]*DeploymentState, error)
- func (e *EnvironmentState) GetDeployments() []*DeploymentState
- func (e *EnvironmentState) GetOrCreateDeploymentState(deploymentName string) (*DeploymentState, error)
- func (e *EnvironmentState) GetProjectName() string
- func (e *EnvironmentState) GetProviders() map[string][]string
- func (e *EnvironmentState) GetProvidersOfType(typ string) []string
- func (e *EnvironmentState) LookupDeploymentState(deploymentName string) (*DeploymentState, error)
- func (e *EnvironmentState) ResolveDeploymentPath(stage, deploymentPath string) (*DeploymentState, error)
- func (e *EnvironmentState) Save(d *DeploymentState) error
- func (e *EnvironmentState) ValidateAndFix(name string, project *ProjectState) error
- type ProjectState
- type StageState
- func (st *StageState) SetInputs(v map[string]interface{}) *StageState
- func (st *StageState) SetOutputs(v map[string]interface{}) *StageState
- func (st *StageState) SetUserInputs(v map[string]interface{}) *StageState
- func (st *StageState) SetVersion(v string) *StageState
- func (st *StageState) Summarize() *StageState
- func (st *StageState) ValidateNames() error
- type Status
- type StatusCode
Constants ¶
View Source
const ( // Initial state Empty StatusCode = "empty" // Configured, but not running Pending = "pending" // Build and deployment phase RunningPreStep = "running_pre_step" RunningMainStep = "running_main_step" RunningPostStep = "running_post_step" // Build and deployment failure Failure = "failure" // Build, deployment, test and smoke success OK = "ok" // Test and smoke phase TestPending = "test_pending" RunningTestStep = "running_test_step" // Test and smoke failure TestFailure = "test_failure" // Destroy phase DestroyPending = "destroy_pending" DestroyAndDeletePending = "destroy_and_delete_pending" RunningPreDestroyStep = "running_pre_destroy_step" RunningMainDestroyStep = "running_main_destroy_step" RunningPostDestroyStep = "running_post_destroy_step" // Destroy failure DestroyFailure = "destroy_failure" )
View Source
const BuildStage = "build"
View Source
const DeployStage = "deploy"
Variables ¶
View Source
var ErrorStatuses = map[StatusCode]bool{ Failure: true, TestFailure: true, DestroyFailure: true, }
View Source
var OKStatuses = map[StatusCode]bool{ Empty: true, Pending: true, OK: true, }
View Source
var RunningStatus = map[StatusCode]bool{}
View Source
var StatusTransitions = map[StatusCode][]StatusCode{ Empty: []StatusCode{Pending}, Pending: []StatusCode{RunningPreStep}, OK: []StatusCode{RunningPreStep, RunningTestStep, DestroyPending, DestroyAndDeletePending, TestPending, Pending, RunningPreDestroyStep}, Failure: []StatusCode{RunningPreStep, Pending, DestroyPending, DestroyAndDeletePending, RunningPreDestroyStep}, TestFailure: []StatusCode{RunningTestStep, RunningPreStep, DestroyPending, DestroyAndDeletePending, TestPending, Pending, RunningPreDestroyStep}, DestroyFailure: []StatusCode{RunningPreDestroyStep, DestroyPending, DestroyAndDeletePending, Pending, RunningPreStep}, RunningPreStep: []StatusCode{RunningMainStep, Failure}, RunningMainStep: []StatusCode{RunningPostStep, Failure}, RunningPostStep: []StatusCode{RunningTestStep, OK, Failure}, RunningTestStep: []StatusCode{OK, TestFailure}, DestroyPending: []StatusCode{RunningPreDestroyStep}, DestroyAndDeletePending: []StatusCode{RunningPreDestroyStep}, RunningPreDestroyStep: []StatusCode{RunningMainDestroyStep, DestroyFailure}, RunningMainDestroyStep: []StatusCode{RunningPostDestroyStep, DestroyFailure}, RunningPostDestroyStep: []StatusCode{Empty, DestroyFailure}, }
Can you go from one state to another?
Functions ¶
func MissingDeploymentStateError ¶
func MissingDeploymentStateError() error
func StatusTransitionAllowed ¶
func StatusTransitionAllowed(s1, s2 StatusCode) bool
Can you go from s1 -> s2?
func ToScriptEnvironment ¶
func ToScriptEnvironment(d *DeploymentState, metadata *core.ReleaseMetadata, stage string, context DeploymentResolver) (*script.ScriptEnvironment, error)
func ToScriptEnvironmentForDependencyStep ¶
func ToScriptEnvironmentForDependencyStep(d *DeploymentState, metadata *core.ReleaseMetadata, stage string, context DeploymentResolver) (*script.ScriptEnvironment, error)
Types ¶
type Backend ¶
type Backend interface { Save(d *DeploymentState) error DeleteDeployment(project, environmentName, deploymentName string) error }
type DAG ¶
type DAG []*DAGNode
func (DAG) Walk ¶
func (roots DAG) Walk(withFunc func(*DeploymentState))
type DAGNode ¶
type DAGNode struct { Node *DeploymentState AndThen []*DAGNode }
func NewDAGNode ¶
func NewDAGNode(d *DeploymentState) *DAGNode
type DependencyResolver ¶
type DependencyResolver func(*core.DependencyConfig) (*core.ReleaseMetadata, error)
type DeploymentResolver ¶
type DeploymentResolver interface {
GetDependencyMetadata(depend *core.DependencyConfig) (*core.ReleaseMetadata, error)
}
type DeploymentState ¶
type DeploymentState struct { Name string `json:"name"` Release string `json:"release,omitempty"` Stages map[string]*StageState `json:"stages,omitempty"` Inputs map[string]interface{} `json:"inputs,omitempty"` // contains filtered or unexported fields }
func NewDeploymentState ¶
func NewDeploymentState(env *EnvironmentState, name, release string) (*DeploymentState, error)
func (*DeploymentState) CommitVersion ¶
func (d *DeploymentState) CommitVersion(stage string, metadata *core.ReleaseMetadata) error
func (*DeploymentState) ConfigureProviders ¶
func (d *DeploymentState) ConfigureProviders(metadata *core.ReleaseMetadata, stage string, extraProviders map[string]string) error
func (*DeploymentState) GetCalculatedInputs ¶
func (d *DeploymentState) GetCalculatedInputs(stage string) map[string]interface{}
func (*DeploymentState) GetCalculatedOutputs ¶
func (d *DeploymentState) GetCalculatedOutputs(stage string) map[string]interface{}
func (*DeploymentState) GetDeployment ¶
func (d *DeploymentState) GetDeployment(stage, deploymentName string) (*DeploymentState, error)
func (*DeploymentState) GetDeploymentOrMakeNew ¶
func (d *DeploymentState) GetDeploymentOrMakeNew(stage, deploymentName string) (*DeploymentState, error)
func (*DeploymentState) GetDeploymentPath ¶
func (d *DeploymentState) GetDeploymentPath() string
func (*DeploymentState) GetEnvironmentState ¶
func (d *DeploymentState) GetEnvironmentState() *EnvironmentState
func (*DeploymentState) GetName ¶
func (d *DeploymentState) GetName() string
func (*DeploymentState) GetPreStepInputs ¶
func (d *DeploymentState) GetPreStepInputs(stage string) map[string]interface{}
func (*DeploymentState) GetProviders ¶
func (d *DeploymentState) GetProviders(stage string) map[string]string
func (*DeploymentState) GetReleaseId ¶
func (d *DeploymentState) GetReleaseId(stage string) string
func (*DeploymentState) GetReleaseMetadata ¶
func (d *DeploymentState) GetReleaseMetadata(stage string, resolver DependencyResolver) (*core.ReleaseMetadata, error)
func (*DeploymentState) GetRootDeploymentName ¶
func (d *DeploymentState) GetRootDeploymentName() string
func (*DeploymentState) GetRootDeploymentStage ¶
func (d *DeploymentState) GetRootDeploymentStage() string
func (*DeploymentState) GetStageOrCreateNew ¶
func (d *DeploymentState) GetStageOrCreateNew(stage string) *StageState
func (*DeploymentState) GetStatus ¶
func (d *DeploymentState) GetStatus(stage string) *Status
func (*DeploymentState) GetUserInputs ¶
func (d *DeploymentState) GetUserInputs(stage string) map[string]interface{}
func (*DeploymentState) GetVersion ¶
func (d *DeploymentState) GetVersion(stage string) string
func (*DeploymentState) IsDeployed ¶
func (d *DeploymentState) IsDeployed(stage string, metadata *core.ReleaseMetadata) bool
func (*DeploymentState) Save ¶
func (d *DeploymentState) Save() error
func (*DeploymentState) SetFailureStatus ¶
func (d *DeploymentState) SetFailureStatus(stage string, err error, statusCode StatusCode) error
func (*DeploymentState) SetProvider ¶
func (d *DeploymentState) SetProvider(stage, name, deplName string)
func (*DeploymentState) Summarize ¶
func (d *DeploymentState) Summarize() *DeploymentState
func (*DeploymentState) ToJson ¶
func (p *DeploymentState) ToJson() string
func (*DeploymentState) UpdateInputs ¶
func (d *DeploymentState) UpdateInputs(stage string, inputs map[string]interface{}) error
func (*DeploymentState) UpdateOutputs ¶
func (d *DeploymentState) UpdateOutputs(stage string, outputs map[string]interface{}) error
func (*DeploymentState) UpdateStatus ¶
func (d *DeploymentState) UpdateStatus(stage string, status *Status) error
func (*DeploymentState) UpdateUserInputs ¶
func (d *DeploymentState) UpdateUserInputs(stage string, inputs map[string]interface{}) error
func (*DeploymentState) ValidateNames ¶
func (d *DeploymentState) ValidateNames() error
type EnvironmentState ¶
type EnvironmentState struct { Name string `json:"name"` Inputs map[string]interface{} `json:"inputs,omitempty"` Deployments map[string]*DeploymentState `json:"deployments,omitempty"` Project *ProjectState `json:"-"` }
func NewEnvironmentState ¶
func NewEnvironmentState(envName string, project *ProjectState) (*EnvironmentState, error)
func (*EnvironmentState) DeleteDeployment ¶
func (e *EnvironmentState) DeleteDeployment(deploymentName string) error
func (*EnvironmentState) GetDeploymentStateDAG ¶
func (e *EnvironmentState) GetDeploymentStateDAG(stage string) (DAG, error)
func (*EnvironmentState) GetDeploymentStateTopologicalSort ¶
func (e *EnvironmentState) GetDeploymentStateTopologicalSort(stage string) ([]*DeploymentState, error)
func (*EnvironmentState) GetDeployments ¶
func (e *EnvironmentState) GetDeployments() []*DeploymentState
func (*EnvironmentState) GetOrCreateDeploymentState ¶
func (e *EnvironmentState) GetOrCreateDeploymentState(deploymentName string) (*DeploymentState, error)
func (*EnvironmentState) GetProjectName ¶
func (e *EnvironmentState) GetProjectName() string
func (*EnvironmentState) GetProviders ¶
func (e *EnvironmentState) GetProviders() map[string][]string
func (*EnvironmentState) GetProvidersOfType ¶
func (e *EnvironmentState) GetProvidersOfType(typ string) []string
func (*EnvironmentState) LookupDeploymentState ¶
func (e *EnvironmentState) LookupDeploymentState(deploymentName string) (*DeploymentState, error)
func (*EnvironmentState) ResolveDeploymentPath ¶
func (e *EnvironmentState) ResolveDeploymentPath(stage, deploymentPath string) (*DeploymentState, error)
func (*EnvironmentState) Save ¶
func (e *EnvironmentState) Save(d *DeploymentState) error
func (*EnvironmentState) ValidateAndFix ¶
func (e *EnvironmentState) ValidateAndFix(name string, project *ProjectState) error
type ProjectState ¶
type ProjectState struct { Name string `json:"name"` Environments map[string]*EnvironmentState `json:"environments,omitempty"` Backend Backend `json:"-"` }
func NewProjectState ¶
func NewProjectState(prjName string) (*ProjectState, error)
func NewProjectStateFromFile ¶
func NewProjectStateFromFile(prjName, cfgFile string, backend Backend) (*ProjectState, error)
func NewProjectStateFromJsonString ¶
func NewProjectStateFromJsonString(data string, backend Backend) (*ProjectState, error)
func (*ProjectState) CommitDeleteDeployment ¶
func (p *ProjectState) CommitDeleteDeployment(env, depl string) error
func (*ProjectState) GetEnvironmentStateOrMakeNew ¶
func (p *ProjectState) GetEnvironmentStateOrMakeNew(env string) (*EnvironmentState, error)
func (*ProjectState) Save ¶
func (p *ProjectState) Save(d *DeploymentState) error
func (*ProjectState) ToJson ¶
func (p *ProjectState) ToJson() string
func (*ProjectState) ValidateAndFix ¶
func (p *ProjectState) ValidateAndFix() error
type StageState ¶
type StageState struct { UserInputs map[string]interface{} `json:"inputs,omitempty"` Inputs map[string]interface{} `json:"calculated_inputs,omitempty"` Outputs map[string]interface{} `json:"calculated_outputs,omitempty"` Deployments map[string]*DeploymentState `json:"deployments,omitempty"` Providers map[string]string `json:"providers,omitempty"` Provides []string `json:"provides,omitempty"` Version string `json:"version,omitempty"` Status *Status `json:"status,omitempty"` Name string `json:"-"` }
func (*StageState) SetInputs ¶
func (st *StageState) SetInputs(v map[string]interface{}) *StageState
func (*StageState) SetOutputs ¶
func (st *StageState) SetOutputs(v map[string]interface{}) *StageState
func (*StageState) SetUserInputs ¶
func (st *StageState) SetUserInputs(v map[string]interface{}) *StageState
func (*StageState) SetVersion ¶
func (st *StageState) SetVersion(v string) *StageState
func (*StageState) Summarize ¶
func (st *StageState) Summarize() *StageState
func (*StageState) ValidateNames ¶
func (st *StageState) ValidateNames() error
type Status ¶
type Status struct { Code StatusCode `json:"status"` UpdatedAt time.Time `json:"updated_at,omitempty"` UpdatedBy string `json:"updated_by,omitempty"` Data string `json:"data,omitempty"` TryAgainAt *time.Time `json:"try_again_at,omitempty"` Tried int `json:"tried,omitempty"` }
func NewStatus ¶
func NewStatus(code StatusCode) *Status
func (*Status) IsOneOf ¶
func (s *Status) IsOneOf(codes ...StatusCode) bool
type StatusCode ¶
type StatusCode string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.