ufo

package
v0.0.0-...-f6e71b1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

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) 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 UFO

func New

func New(awsConfig *AwsConfig) *UFO

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

func (*UFO) AwaitServicesRunning

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

func (*UFO) Clusters

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

Clusters returns all ECS clusters

func (*UFO) DeployAll

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

func (*UFO) ECRLogin

func (u *UFO) ECRLogin() error

ECRLogin uses an AWS region & profile to login to ECR

func (*UFO) GetCluster

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

GetCluster returns a clusters detail

func (*UFO) GetImages

func (u *UFO) 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 (*UFO) GetLastDeployedCommit

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

GetLastDeployedCommit finds the most recent committed image for a taskDefinition

func (*UFO) GetLogs

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

func (*UFO) GetRepoFromImage

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

GetRepoFromImage parses an image URL:tag and reads its repo

func (*UFO) GetService

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

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

func (*UFO) GetTaskDefinition

func (u *UFO) 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 (*UFO) GetTasks

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

GetTasks gets all tasks in a cluster

func (*UFO) IsServiceRunning

func (u *UFO) 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 (*UFO) IsTaskRunning

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

func (*UFO) LoginBuildPushImage

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

func (*UFO) NewDeployDetail

func (u *UFO) NewDeployDetail() *DeployDetail

func (*UFO) RegisterTaskDefinitionWithEnvVars

func (u *UFO) 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 (*UFO) RegisterTaskDefinitionWithImage

func (u *UFO) RegisterTaskDefinitionWithImage(c *ecs.Cluster, s *ecs.Service, 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 (*UFO) RollbackAll

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

func (*UFO) RollbackService

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

RollbackService updates the ECS service with the desired rollback revision

func (*UFO) RollbackTaskDefinition

func (u *UFO) 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 (*UFO) RunTask

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

RunTask runs a specified task in a cluster

func (*UFO) RunningTasks

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

RunningTasks gets all running tasks in a cluster and service

func (*UFO) Services

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

Services returns all services in a cluster

func (*UFO) UpdateService

func (u *UFO) 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 (*UFO) UpdateServiceWithNewTaskDefinition

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

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

func (*UFO) UpdateTaskDefinitionImage

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

UpdateTaskDefinitionImage copies a task definition and update its image tag

Jump to

Keyboard shortcuts

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