spawner

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2020 License: MIT Imports: 26 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Destroyed                    = models.Destroyed
	Spawned                      = models.Spawned
	Failure                      = models.Failure
	Updating                     = models.Updating
	Success                      = models.Success
	DestroyApiRequest            = models.DestroyApiRequest
	EnvironmentLimitExceeded     = models.EnvironmentLimitExceeded
	ReapPrClosed                 = models.ReapPrClosed
	ReapAgeSpawned               = models.ReapAgeSpawned
	ReapAgeFailure               = models.ReapAgeFailure
	ReapEnvironmentLimitExceeded = models.ReapEnvironmentLimitExceeded
	Update                       = ghevent.Update
	CreateNew                    = ghevent.CreateNew
	Destroy                      = ghevent.Destroy
	NotRelevant                  = ghevent.NotRelevant
)
View Source
const (
	TagBranchMatchFallbackBranch = "master"
)

Variables

View Source
var NewPreemptiveLocker = locker.NewPreemptiveLocker

Functions

func GetNRTxnFromContext

func GetNRTxnFromContext(ctx context.Context) (newrelic.Transaction, bool)

GetNRTxnFromContext returns the New Relic transaction (or nil) and a boolean indicating whether it exists

func NewNRTxnContext

func NewNRTxnContext(ctx context.Context, txn newrelic.Transaction) context.Context

NewNRTxnContext returns a context with the New Relic transaction embedded as a value

Types

type AWSConfig

type AWSConfig = config.AWSConfig

type AWSCreds

type AWSCreds = config.AWSCreds

type AcylBackend

type AcylBackend interface {
	CreateEnvironment(ctx context.Context, qa *QAEnvironment, qat *QAType) (string, error)
	DestroyEnvironment(ctx context.Context, qae *QAEnvironment, dns bool) error
}

AcylBackend defines the different operations that can be performed on an Acyl backend.

type AminoBackend

type AminoBackend struct {
	// contains filtered or unexported fields
}

AminoBackend provides a Acyl backend that uses Amino.

func (*AminoBackend) CreateEnvironment

func (a *AminoBackend) CreateEnvironment(ctx context.Context, qa *QAEnvironment, qat *QAType) (string, error)

CreateEnvironment creates a QA environment using the Amino API.

func (*AminoBackend) DestroyEnvironment

func (a *AminoBackend) DestroyEnvironment(ctx context.Context, qae *QAEnvironment, dns bool) error

DestroyEnvironment destroys a Amino environment.

func (*AminoBackend) ManagesDNS

func (a *AminoBackend) ManagesDNS() bool

ManagesDNS returns whether Amino manages DNS.

type AminoConfig

type AminoConfig = config.AminoConfig

type BackendConfig

type BackendConfig = config.BackendConfig

type BadSignature

type BadSignature = ghevent.BadSignature

type BranchInfo

type BranchInfo = ghclient.BranchInfo

type ChatNotifier

type ChatNotifier = slacknotifier.ChatNotifier

type CommitStatus

type CommitStatus = ghclient.CommitStatus

type ConsulConfig

type ConsulConfig = config.ConsulConfig

type DNSManager

type DNSManager interface {
	GetPrimaryHostname([]string, string) (string, error)
	CreateRecords(string, string, *QAType) error
	DeleteRecords(string, string, *QAType) error
}

DNSManager describes an object that can create or delete DNS records

type DataLayer

type DataLayer = persistence.DataLayer

type EnvironmentSpawner

EnvironmentSpawner describes an object capable of managing environments

type EnvironmentStatus

type EnvironmentStatus = models.EnvironmentStatus

type FakeEnvironmentSpawner

type FakeEnvironmentSpawner struct {
	CreateFunc            func(ctx context.Context, rd models.RepoRevisionData) (string, error)
	UpdateFunc            func(ctx context.Context, rd models.RepoRevisionData) (string, error)
	DestroyFunc           func(ctx context.Context, rd models.RepoRevisionData, reason models.QADestroyReason) error
	DestroyExplicitlyFunc func(ctx context.Context, env *models.QAEnvironment, reason models.QADestroyReason) error
	SuccessFunc           func(ctx context.Context, name string) error
	FailureFunc           func(ctx context.Context, name, msg string) error
}

func (*FakeEnvironmentSpawner) Create

func (*FakeEnvironmentSpawner) Destroy

func (*FakeEnvironmentSpawner) DestroyExplicitly

func (fes *FakeEnvironmentSpawner) DestroyExplicitly(ctx context.Context, env *models.QAEnvironment, reason models.QADestroyReason) error

func (*FakeEnvironmentSpawner) Failure

func (fes *FakeEnvironmentSpawner) Failure(ctx context.Context, name, msg string) error

func (*FakeEnvironmentSpawner) Success

func (fes *FakeEnvironmentSpawner) Success(ctx context.Context, name string) error

func (*FakeEnvironmentSpawner) Update

type GitHubEventWebhook

type GitHubEventWebhook = ghevent.GitHubEventWebhook

type GithubConfig

type GithubConfig = config.GithubConfig

type LockProvider

type LockProvider = locker.LockProvider

type MetricsCollector

type MetricsCollector = metrics.Collector

type MigrateConfig

type MigrateConfig = config.MigrateConfig

type NameGenerator

type NameGenerator = namegen.NameGenerator

type OperationMetricsCollector

type OperationMetricsCollector interface {
	Operation(op, name, repo, ref string, err error)
}

type PreemptiveLockProvider

type PreemptiveLockProvider = locker.PreemptiveLockProvider

type PreemptiveLocker

type PreemptiveLocker = locker.PreemptiveLocker

type ProvisioningMetricsCollector

type ProvisioningMetricsCollector interface {
	ProvisioningMetricsTimer

	ProvisioningDuration(string, string, string, time.Duration, error)
	ContainerBuildAllDuration(string, string, string, time.Duration, error)
	ContainerBuildDuration(string, string, string, string, string, time.Duration, error)

	Success(string, string, string)
	Failure(string, string, string)
	AminoDeployTimedOut(name, repo, ref string)
	ImageBuildFailed(name, repo, ref string)
}

type ProvisioningMetricsTimer

type ProvisioningMetricsTimer interface {
	TimeProvisioning(string, string, string, *error) func()
	TimeContainerBuildAll(string, string, string, *error) func()
	TimeContainerBuild(string, string, string, string, string, *error) func()
}

type QADestroyReason

type QADestroyReason = models.QADestroyReason

type QAEnvironment

type QAEnvironment = models.QAEnvironment

type QAEnvironmentEvent

type QAEnvironmentEvent = models.QAEnvironmentEvent

type QAEnvironments

type QAEnvironments = models.QAEnvironments

type QASpawner

type QASpawner struct {
	// contains filtered or unexported fields
}

QASpawner is an object that can manage environments in AWS

func NewQASpawner

func NewQASpawner(logger *log.Logger, dl DataLayer, ng NameGenerator, rc RepoClient, lp PreemptiveLockProvider, furanAddrs []string, consulAddr string, cn ChatNotifier, omc MetricsCollector, pmc MetricsCollector, nrapp newrelic.Application, awsCreds *AWSCreds, awsConfig *AWSConfig, backendConfig *BackendConfig, ac *AminoConfig, typepath string, globalLimit uint, hostnameTemplate string, datadogServiceNamePrefix string) (*QASpawner, error)

NewQASpawner returns a new QASpawner instance with the specified logger and datalayer

func (*QASpawner) Create

func (qs *QASpawner) Create(ctx context.Context, rd RepoRevisionData) (string, error)

Create creates a new QA of the specified type, returning the name

func (*QASpawner) Destroy

func (qs *QASpawner) Destroy(ctx context.Context, rd RepoRevisionData, reason QADestroyReason) error

Destroy destroys a specific named QA environment

func (*QASpawner) DestroyExplicitly

func (qs *QASpawner) DestroyExplicitly(ctx context.Context, qa *QAEnvironment, reason QADestroyReason) error

DestroyExplicitly destroys a QA by name explicitly

func (*QASpawner) Failure

func (qs *QASpawner) Failure(ctx context.Context, name string, message string) error

Failure marks an environment as failed

func (*QASpawner) Success

func (qs *QASpawner) Success(ctx context.Context, name string) error

Success marks an environment as successfully up and ready

func (*QASpawner) Update

func (qs *QASpawner) Update(ctx context.Context, rd RepoRevisionData) (string, error)

Update destroys and replaces a QA environment with new code (if one exists) but same name

type QAType

type QAType = models.QAType

type RefMap

type RefMap = models.RefMap

type RepoClient

type RepoClient = ghclient.RepoClient

type RepoRevisionData

type RepoRevisionData = models.RepoRevisionData

type SecretsConfig

type SecretsConfig = config.SecretsConfig

type ServerConfig

type ServerConfig = config.ServerConfig

type SlackConfig

type SlackConfig = config.SlackConfig

type VaultConfig

type VaultConfig = config.VaultConfig

Directories

Path Synopsis
Package pbaminoapi is a generated protocol buffer package.
Package pbaminoapi is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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