deployment

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskPending = "PENDING"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Deployment

type Deployment interface {
	// CreateDeployment creates a new deployment in the provided environment and updates the
	// environment's pending deployment ID to the ID of the deployment created. The environment
	// token must match the provided token, otherwise the deployment creation will fail.
	CreateDeployment(ctx context.Context, environmentName string, token string) (*types.Deployment, error)
	// CreateSubDeployment kicks off a deployment corresponding to the in progress deployment ID
	// in the environment to start tasks on given instances
	CreateSubDeployment(ctx context.Context, environmentName string, instanceARNs []*string) (*types.Deployment, error)
	// StartDeployment kicks off the provided deployment in the given environment (by starting tasks)
	StartDeployment(ctx context.Context, env *types.Environment, deployment *types.Deployment, instanceARNs []*string) (*types.Deployment, error)

	// GetDeployment returns the deployment with the provided id in the provided environment
	GetDeployment(ctx context.Context, environmentName string, id string) (*types.Deployment, error)
	// GetCurrentDeployment returns the deployment which needs to be used for starting tasks, i.e.
	// the in-progress deployment for the environment if one exists, otherwise the latest completed deployment.
	GetCurrentDeployment(ctx context.Context, environmentName string) (*types.Deployment, error)
	// GetPendingDeployment returns the pending deployment for the environment deployment.
	// There should be no more than one pending deployments in an environment.
	GetPendingDeployment(ctx context.Context, environmentName string) (*types.Deployment, error)
	// GetInProgressDeployment returns the in-progress deployment for the environmentName.
	// There should be no more than one in progress deployments in an environment.
	GetInProgressDeployment(ctx context.Context, environmentName string) (*types.Deployment, error)
	// ListDeploymentsSortedReverseChronologically returns a list of deployments reverse-ordered by start time,
	// i.e. lastest deployment first
	ListDeploymentsSortedReverseChronologically(ctx context.Context, environmentName string) ([]types.Deployment, error)
}

TODO: refactor to remove multiple environment retrievals from the database in methods like CreateSubDeployment (check unit tests for GetEnvironment.Times(2 or 3))

func NewDeployment

func NewDeployment(
	environment Environment,
	clusterState facade.ClusterState,
	ecs facade.ECS) Deployment

type DeploymentWorker

type DeploymentWorker interface {
	StartPendingDeployment(ctx context.Context, environmentName string) (*types.Deployment, error)
	// UpdateInProgressDeployment checks for in-progress deployments and moves them to complete when
	// the tasks started by the deployment have moved out of pending status
	UpdateInProgressDeployment(ctx context.Context, environmentName string) (*types.Deployment, error)
}

func NewDeploymentWorker

func NewDeploymentWorker(
	environment Environment,
	environmentFacade types.EnvironmentFacade,
	deployment Deployment,
	ecs facade.ECS,
	css facade.ClusterState) DeploymentWorker

type Environment

type Environment interface {
	// CreateEnvironment stores a new environment in the database
	CreateEnvironment(ctx context.Context, name string, taskDefinition string, cluster string) (*types.Environment, error)
	// GetEnvironment gets the environment with the provided name from the database
	GetEnvironment(ctx context.Context, name string) (*types.Environment, error)
	// DeleteEnvironment deletes the environment with the provided name from the database
	DeleteEnvironment(ctx context.Context, name string) error
	// ListEnvironments returns a list with all the existing environments
	ListEnvironments(ctx context.Context) ([]types.Environment, error)
	// FilterEnvironments returns a list of all environments that match the filters
	FilterEnvironments(ctx context.Context, filterKey string, filterVal string) ([]types.Environment, error)

	//TODO: reconsider how these methods are structured when adding transactions (do we need 2 separate methods? etc)
	// AddPendingDeployment adds a deployment to the environment if a deployment with
	// the provided ID does not exist
	AddPendingDeployment(ctx context.Context, environment types.Environment, deployment types.Deployment) (*types.Environment, error)
	// UpdateDeployment replaces an existing deployment in the environment with the
	// provided one if a deployment with the provided ID already exists
	UpdateDeployment(ctx context.Context, environment types.Environment, deployment types.Deployment) (*types.Environment, error)
}

func NewEnvironment

func NewEnvironment(environmentStore store.EnvironmentStore) (Environment, error)

Jump to

Keyboard shortcuts

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