common

package
v0.0.0-...-1316712 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2016 License: MIT Imports: 4 Imported by: 8

Documentation

Overview

Describes interfaces for sharing information between the configuration and the execution of deployments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalNameForRepository

func CanonicalNameForRepository(repository Repository) string

func HumanDescriptionOfDeployment

func HumanDescriptionOfDeployment(deployment Deployment) string

Types

type Application

type Application interface {
	Name() string
	Repository() Repository
	// Returns the strategy to use for deploying to a given environment or nil
	// if no strategy could be determined.
	StrategyForEnvironment(string) Strategy
}

type ArchiveFormat

type ArchiveFormat string

The `go-github` library doesn't export a visible archive format, so we have to use our own.

const (
	Tarball ArchiveFormat = "tarball"
	Zipball ArchiveFormat = "zipball"
)

type Deployment

type Deployment interface {
	UUID() uuid.UUID
	Application() Application
	Environment() string
	Strategy() Strategy
	GithubClient() (*github.Client, error)
	Ref() string
	SHA1() string
	SetSHA1(string)
	// Return the SHA1 if known, otherwise the ref
	MostPreciseRef() string
	// Users can tweak the operation of the deploy via flags, eg. a "force"
	// flag to skip some checks.
	Flags() map[string]interface{}
	HasFlag(string) bool
	Flag(string) interface{}
	SetFlag(string, interface{})
	IsForce() bool

	Status() DeploymentStatus
}

type DeploymentState

type DeploymentState int
const (
	DEPLOYMENT_PENDING DeploymentState = iota
	RUNNING_PRECONDITIONS
	RUNNING_PHASE
	DEPLOYMENT_DONE
	DEPLOYMENT_ERROR
)

func (DeploymentState) String

func (state DeploymentState) String() string

type DeploymentStatus

type DeploymentStatus struct {
	State DeploymentState
	Phase Phase
	Error error
}

type GithubRepository

type GithubRepository struct {
	Repository   Repository
	GithubClient *github.Client
}

func NewGithubRepository

func NewGithubRepository(repository Repository, githubClient *github.Client) *GithubRepository

func NewGithubRepositoryFromDeployment

func NewGithubRepositoryFromDeployment(deployment Deployment) (*GithubRepository, error)

func (*GithubRepository) CompareCommits

func (repo *GithubRepository) CompareCommits(base, head string) (*github.CommitsComparison, error)

func (*GithubRepository) Get

func (repo *GithubRepository) Get() (*github.Repository, error)
func (repo *GithubRepository) GetArchiveLink(format ArchiveFormat, ref string) (string, error)

`format` should be one of "tarball" or "zipball".

func (*GithubRepository) GetCommitSHA1

func (repo *GithubRepository) GetCommitSHA1(ref string) (string, error)

func (*GithubRepository) Merge

func (repo *GithubRepository) Merge(base, head, commitMessage string) (*github.RepositoryCommit, error)

func (*GithubRepository) OwnerAndName

func (repo *GithubRepository) OwnerAndName() (string, string)

type Phase

type Phase interface {
	CanPreload() bool
	// Second argument is the result from the preload, or `nil` if the phase
	// doesn't preload.
	Execute(Deployment, interface{}) error
}

type Precondition

type Precondition interface {
	Status(Deployment) error
}

type PreloadablePhase

type PreloadablePhase interface {
	// Returns data specific to the phase for it to use later on; if it
	// returns an error then the deployment is cancelled.
	Preload(Deployment) (interface{}, error)
}

type Repository

type Repository interface {
	Owner() string
	Name() string
}

type Store

type Store interface {
	SaveDeployment(Deployment) error
	// Look up a `Deployment` for an application environment.
	FindDeployment(application Application, environment string) (Deployment, error)

	// Returns whether or not there is an in-progress deployment to a given
	// application environment.
	HasActiveDeployment(Application, string) (bool, error)
}

type Strategy

type Strategy interface {
	Preconditions() []Precondition
	Phases() []Phase
	OnError(Deployment, error)
}

Jump to

Keyboard shortcuts

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