devenv

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// STATE is the name of the state attribute in the DB
	STATE = "state"
	// NAME is the name of the name attribute in the DB :)
	NAME = "name"
	// NEW is the state when an env is new
	NEW = "new"
	// PROCESSED is the state when an env has been processed by the runner
	PROCESSED = "processed"
	// DELETED is when at least one of the branches for this env have been deleted
	DELETED = "deleted"
)

Variables

This section is empty.

Functions

func DeleteTable added in v0.2.0

func DeleteTable(db dynamodbiface.ClientAPI, table string) error

DeleteTable unconditionally deletes the table

func EnsureTableExists added in v0.2.0

func EnsureTableExists(db dynamodbiface.ClientAPI, table string) error

EnsureTableExists creates a PAY_PER_REQUEST DynamoDB table. If the table already exists, it is not re-created nor is an error raised. Will create the table if ResourceNotFound is received

func ListClusters added in v1.3.9

func ListClusters(svc ecsiface.ClientAPI) ([]string, error)

ListClusters will return a list running ECS clusters. Just the names.

func Tdb added in v1.4.0

func Tdb(image string, cmds ...string) error

Types

type DevEnv added in v0.2.0

type DevEnv struct {
	Name string `json:"name"`
	// contains filtered or unexported fields
}

DevEnv represents the known (or desired) state of an environment based on the state in DynamoDB. This type is concerned with management of the DynamoDB item representing the state of an environment named DevEnv.Name

func GetDevEnv added in v1.4.0

func GetDevEnv(svc dynamodbiface.ClientAPI, table string, envName string) (*DevEnv, error)

GetDevEnv will get the named env with the supplied name from the DB

func GetEnvsByState added in v1.4.0

func GetEnvsByState(svc dynamodbiface.ClientAPI, table string, state string, repos []string) ([]DevEnv, error)

GetEnvsByState will fetch all envs in the supplied state from the DB Only attribute names matching the list in repos will be fetched If any error occurs while retrieving an env, it fails immediately and returns the list of envs that have been retrieved so far

func NewDevEnv added in v1.4.0

func NewDevEnv(name string, db dynamodbiface.ClientAPI, table string) *DevEnv

NewDevEnv returns an unsaved environment but the env is ready to be saved

func (*DevEnv) Delete added in v1.4.0

func (d *DevEnv) Delete() error

Delete will delete the env if its internal state is devenv.DELETED

func (*DevEnv) MarkDeleted added in v1.4.0

func (d *DevEnv) MarkDeleted()

func (*DevEnv) MarkNew added in v1.4.0

func (d *DevEnv) MarkNew()

func (*DevEnv) MarkProcessed added in v1.4.0

func (d *DevEnv) MarkProcessed()

func (*DevEnv) MergeVersions added in v1.4.0

func (d *DevEnv) MergeVersions(vs VersionMap) error

func (*DevEnv) Reap added in v1.4.0

func (d *DevEnv) Reap(confPath string) error

Reap will destroy an env that was created with Sow() and delete it from the DB

func (*DevEnv) Save added in v1.4.0

func (d *DevEnv) Save() error

Save will save the env to the DB, creating the item if needed

func (*DevEnv) SetVersion added in v1.4.0

func (d *DevEnv) SetVersion(repo string, version string)

func (*DevEnv) SetVersions added in v1.4.0

func (d *DevEnv) SetVersions(vs VersionMap)

func (*DevEnv) Sow added in v1.4.0

func (d *DevEnv) Sow(confPath string) error

Sow will run an deploy an env with terraform

func (*DevEnv) VersionMap added in v1.4.0

func (d *DevEnv) VersionMap() VersionMap

Promote all versions to top-level keys. This is done so that VersionMap can support any list of repos at run time

type ExistsError added in v0.2.0

type ExistsError baseError

ExistsError is used when the environment exists but was updated via a method that is not idempotent

func (ExistsError) Error added in v0.2.0

func (e ExistsError) Error() string

type GromitClient added in v1.3.13

type GromitClient struct {
	Server    string
	AuthToken string
	Client    http.Client
}

func (*GromitClient) Delete added in v1.3.13

func (g *GromitClient) Delete(name string) error

Delete uses DELETE to delete the env

func (*GromitClient) Get added in v1.3.13

func (g *GromitClient) Get(name string) (string, error)

Get will return an env map

func (*GromitClient) Replace added in v1.3.13

func (g *GromitClient) Replace(name string, body io.Reader) error

Replace uses PUT to replace the env

type GromitCluster added in v1.4.0

type GromitCluster struct {
	Name   string
	Region string
	// contains filtered or unexported fields
}

GromitCluster represents an ECS cluster running an environment that was spun up by DevEnv.Sow() It represents the runtime state (ECR, ECS, R53) of an environment and is intended to encapsulate the AWS implementation specific details All its methods are read-only except for SyncDNS which will update the public Route53 entries for a developer environment

func FastFetchClusters added in v1.4.0

func FastFetchClusters(cnames []string) []*GromitCluster

FastFetchClusters will fetch an array of clusters concurrently

func GetGromitCluster added in v1.4.0

func GetGromitCluster(name string) (*GromitCluster, error)

GetGromitCluster returns a fully populated gromit cluster

func (*GromitCluster) Populate added in v1.4.0

func (c *GromitCluster) Populate() error

Populate will look up all tasks in this cluster and fill in the tasks array with IPs

func (*GromitCluster) SyncDNS added in v1.4.0

func (c *GromitCluster) SyncDNS(action route53.ChangeAction, zoneid string, domain string) error

SyncDNS will update the public Route53 records for cluster in zoneid The FQDN is constructed by appending domain to the task name

type GromitTask added in v1.4.0

type GromitTask struct {
	Name string
	IP   string
}

GromitTask is used inside GromitCluster

type NotFoundError added in v0.2.0

type NotFoundError baseError

NotFoundError is used to distinguish between other errors and this expected error in getEnv and elsewhere

func (NotFoundError) Error added in v0.2.0

func (e NotFoundError) Error() string

type VersionMap added in v1.4.0

type VersionMap map[string]string

VersionMap maps repos to any tree-ish in git

func GetECRState added in v0.2.0

func GetECRState(svc ecriface.ClientAPI, registry string, envName string, repos []string) (VersionMap, error)

GetECRState returns master as the tree-ish if no env was found

Jump to

Keyboard shortcuts

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