outback

package
v0.0.0-...-2e2a65e Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const DEPLOY_SHA_ENV_VAR = "OUTBACK_DEPLOY_GIT_SHA"
View Source
const DEPLOY_TIME_ENV_VAR = "OUTBACK_DEPLOY_TIME"

Variables

This section is empty.

Functions

This section is empty.

Types

type AwsConfig

type AwsConfig struct {
	Profile string
	Region  string
}

type BuildDetail

type BuildDetail struct {
	Repo       string
	CommitHash string
	Dockerfile string
	// contains filtered or unexported fields
}

type DeployDetail

type DeployDetail struct {
	Cluster                  *ecs.Cluster
	Service                  *ecs.Service
	TaskDefinition           *ecs.TaskDefinition
	TaskDefinitionFamilyName string
	RevisionNumber           int
	Done                     bool
}

func (*DeployDetail) SetCluster

func (d *DeployDetail) SetCluster(cluster *ecs.Cluster)

func (*DeployDetail) SetDone

func (d *DeployDetail) SetDone(done bool)

func (*DeployDetail) SetRevisionNumber

func (d *DeployDetail) SetRevisionNumber(revisionNumber int)

func (*DeployDetail) SetService

func (d *DeployDetail) SetService(service *ecs.Service)

func (*DeployDetail) SetTaskDefinition

func (d *DeployDetail) SetTaskDefinition(taskDef *ecs.TaskDefinition)

func (*DeployDetail) SetTaskDefinitionFamilyName

func (d *DeployDetail) SetTaskDefinitionFamilyName(TaskDefinitionFamilyName string)

func (*DeployDetail) TaskDefinitionFamily

func (d *DeployDetail) TaskDefinitionFamily() string

type Deployment

type Deployment struct {
	DeployDetails []*DeployDetail
	BuildDetail   BuildDetail
	Err           error
}

func (*Deployment) Services

func (d *Deployment) Services() string

func (*Deployment) SetBuildArgs

func (d *Deployment) SetBuildArgs(buildArgs []string)

func (*Deployment) SetBuildCacheFrom

func (d *Deployment) SetBuildCacheFrom(cacheFrom []string)

func (*Deployment) SetCommitHash

func (d *Deployment) SetCommitHash(commit string)

func (*Deployment) SetConfigBuildArgs

func (d *Deployment) SetConfigBuildArgs(configBuildArgs []string)

func (*Deployment) SetDockerfile

func (d *Deployment) SetDockerfile(dockerfile string)

func (*Deployment) SetRepo

func (d *Deployment) SetRepo(repo string)

func (*Deployment) TaskDefinitions

func (d *Deployment) TaskDefinitions() string

type GetLogsInput

type GetLogsInput struct {
	Filter         string
	LogGroupName   string
	LogStreamNames []string
	EndTime        time.Time
	StartTime      time.Time
}

type LogLine

type LogLine struct {
	EventID       string
	LogStreamName string
	Message       string
	Timestamp     time.Time
}

type Outback

type Outback struct {
	Config *AwsConfig
	ECS    ecsiface.ECSAPI
	ECR    ecriface.ECRAPI
	CWL    cloudwatchlogsiface.CloudWatchLogsAPI
}

func New

func New(awsConfig *AwsConfig) *Outback

New creates a Outback session and connects to AWS to create a session

func (*Outback) AwaitServicesRunning

func (u *Outback) AwaitServicesRunning(deployment *Deployment) chan *DeployDetail

func (*Outback) Clusters

func (u *Outback) Clusters() ([]string, error)

Clusters returns all ECS clusters

func (*Outback) DeployAll

func (u *Outback) DeployAll(deploy *Deployment) <-chan error

func (*Outback) ECRLogin

func (u *Outback) ECRLogin() error

ECRLogin uses an AWS region & profile to login to ECR

func (*Outback) GetCluster

func (u *Outback) GetCluster(name string) (*ecs.Cluster, error)

GetCluster returns a clusters detail

func (*Outback) GetImages

func (u *Outback) GetImages(t *ecs.TaskDefinition) ([]*ecr.ImageDetail, error)

GetImages gets images for a task definition @todo how does this handle multiple images in a task def?

func (*Outback) GetLastDeployedCommit

func (u *Outback) GetLastDeployedCommit(taskDefinition string) (string, error)

GetLastDeployedCommit finds the most recent committed image for a taskDefinition

func (*Outback) GetLogs

func (u *Outback) GetLogs(i *GetLogsInput) ([]LogLine, error)

func (*Outback) GetRepoFromImage

func (u *Outback) GetRepoFromImage(image *string) string

GetRepoFromImage parses an image URL:tag and reads its repo

func (*Outback) GetService

func (u *Outback) GetService(c *ecs.Cluster, service string) (*ecs.Service, error)

GetService returns service details within a cluster by service name or ARN

func (*Outback) GetTaskDefinition

func (u *Outback) GetTaskDefinition(c *ecs.Cluster, s *ecs.Service) (*ecs.TaskDefinition, error)

GetTaskDefinition returns details of a task definition in a cluster and service by service's current task definition

func (*Outback) GetTasks

func (u *Outback) GetTasks(c *ecs.Cluster, tasks []*string) ([]*ecs.Task, error)

GetTasks gets all tasks in a cluster

func (*Outback) IsServiceRunning

func (u *Outback) IsServiceRunning(detail *DeployDetail) bool

IsServiceRunning is meant to be called after a service update. This function checks if the newly started task has the status "RUNNING"

func (*Outback) IsTaskRunning

func (u *Outback) IsTaskRunning(cluster *string, task *string) error

func (*Outback) LoginBuildPushImage

func (u *Outback) LoginBuildPushImage(info BuildDetail) error

func (*Outback) LoginPullImage

func (u *Outback) LoginPullImage(repo string, tag string) error

func (*Outback) NewDeployDetail

func (u *Outback) NewDeployDetail() *DeployDetail

func (*Outback) RegisterTaskDefinitionWithEnvVars

func (u *Outback) RegisterTaskDefinitionWithEnvVars(t *ecs.TaskDefinition) (*ecs.TaskDefinition, error)

RegisterTaskDefinitionWithEnvVars takes a task definition as an argument and updates its ContainerDefinitions field which contains environment variables

func (*Outback) RegisterTaskDefinitionWithImage

func (u *Outback) RegisterTaskDefinitionWithImage(c *ecs.Cluster, s *ecs.Service, repo string, tag string) (*ecs.TaskDefinition, error)

RegisterTaskDefinitionWithImage creates a new task definition with the provided tag This copies an existing task definition and only changes the tag used for the image

func (*Outback) RollbackAll

func (u *Outback) RollbackAll(deploy *Deployment, deployDetail *DeployDetail) <-chan error

func (*Outback) RollbackService

func (u *Outback) RollbackService(c *ecs.Cluster, s *ecs.Service, t string) (*ecs.UpdateServiceOutput, error)

RollbackService updates the ECS service with the desired rollback revision

func (*Outback) RollbackTaskDefinition

func (u *Outback) RollbackTaskDefinition(c *ecs.Cluster, s *ecs.Service, t *ecs.TaskDefinition, n int) (string, error)

RollbackTaskDefinition updates the task definition to the desired revision number

func (*Outback) RunTask

func (u *Outback) RunTask(c *ecs.Cluster, t *ecs.TaskDefinition, cmd string) (*ecs.RunTaskOutput, error)

RunTask runs a specified task in a cluster

func (*Outback) RunningTasks

func (u *Outback) RunningTasks(c *ecs.Cluster, s *ecs.Service) ([]*string, error)

RunningTasks gets all running tasks in a cluster and service

func (*Outback) Services

func (u *Outback) Services(c *ecs.Cluster) ([]string, error)

Services returns all services in a cluster

func (*Outback) UpdateContainerDefinitionEnvVars

func (u *Outback) UpdateContainerDefinitionEnvVars(t ecs.TaskDefinition, updates []*ecs.KeyValuePair, repo string) ecs.TaskDefinition

UpdateContainerDefinitionEnvVars copies a task definition and updates the container definition environment

func (*Outback) UpdateService

func (u *Outback) UpdateService(c *ecs.Cluster, s *ecs.Service, t *ecs.TaskDefinition) (*ecs.UpdateServiceOutput, error)

UpdateService updates a service in a cluster with a new task definition

func (*Outback) UpdateServiceWithNewTaskDefinition

func (u *Outback) UpdateServiceWithNewTaskDefinition(c *ecs.Cluster, s *ecs.Service, repo string, tag string) (*ecs.TaskDefinition, error)

UpdateServiceWithNewTaskDefinition registers a task definition with a tag and updates a service with the newly registered task definition

func (*Outback) UpdateTaskDefinitionImage

func (u *Outback) UpdateTaskDefinitionImage(t ecs.TaskDefinition, repo string, tag string) ecs.TaskDefinition

UpdateTaskDefinitionImage copies a task definition and updates its image tag

Jump to

Keyboard shortcuts

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