Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyAnsiStyle(text string, style ...int) string
- func BuildAnsiStyle(parts ...int) string
- func GetNextFriendlyColor() int
- func NewContainerKiller(step Step) func() (int, error)
- func NewContainerRemover(step Step) func() error
- func NewContainerRunner(step Step, network string) func() error
- func NewImageBuilder(step Step, pull bool) func() error
- func NewImageExistenceChecker(step Step) func() error
- func NewImagePuller(step Step) func() error
- func NewNetworkCreator(p Pipeline) func() error
- func NewNetworkRemover(p Pipeline) func() error
- type BuildInfo
- type ColorStore
- type Executable
- type LocalRunner
- type LogSettings
- type Pipeline
- func (p Pipeline) BuildImages(force bool) error
- func (p Pipeline) Check() error
- func (p *Pipeline) CleanUp(signal os.Signal)
- func (p Pipeline) CreateNetwork() error
- func (p Pipeline) ExecuteSteps() error
- func (p Pipeline) KillContainers(preRun bool) error
- func (p Pipeline) PullImages(force bool) error
- func (p Pipeline) RemoveContainers(preRun bool) error
- func (p Pipeline) RemoveNetwork() error
- func (p Pipeline) RemoveTempDirData() error
- func (p Pipeline) Runner() Runner
- type PipelineDefinition
- type PipelineEnvironment
- type Pipelines
- type PrefixedLogger
- type PrefixedWriter
- type Runner
- type Service
- type ServiceKeepAlive
- type ServiceList
- type ServiceLog
- type ServiceLogHandler
- type ServiceMeta
- type ServiceMetaList
- type ServiceType
- type Step
- type StepList
Constants ¶
const AnsiForegroundColorBlack int = 30
AnsiForegroundColorBlack stores int value for black foreground
const AnsiForegroundColorBlue int = 34
AnsiForegroundColorBlue stores int value for blue foreground
const AnsiForegroundColorCyan int = 36
AnsiForegroundColorCyan stores int value for cyan foreground
const AnsiForegroundColorDarkGray int = 90
AnsiForegroundColorDarkGray stores int value for dark gray foreground
const AnsiForegroundColorGreen int = 32
AnsiForegroundColorGreen stores int value for green foreground
const AnsiForegroundColorLightBlue int = 94
AnsiForegroundColorLightBlue stores int value for light blue foreground
const AnsiForegroundColorLightCyan int = 96
AnsiForegroundColorLightCyan stores int value for light cyan foreground
const AnsiForegroundColorLightGray int = 37
AnsiForegroundColorLightGray stores int value for light gray foreground
const AnsiForegroundColorLightGreen int = 92
AnsiForegroundColorLightGreen stores int value for light green foreground
const AnsiForegroundColorLightMagenta int = 95
AnsiForegroundColorLightMagenta stores int value for light magenta foreground
const AnsiForegroundColorLightRed int = 91
AnsiForegroundColorLightRed stores int value for light red foreground
const AnsiForegroundColorLightYellow int = 93
AnsiForegroundColorLightYellow stores int value for light yellow foreground
const AnsiForegroundColorMagenta int = 35
AnsiForegroundColorMagenta stores int value for magenta foreground
const AnsiForegroundColorRed int = 31
AnsiForegroundColorRed stores int value for red foreground
const AnsiForegroundColorWhite int = 97
AnsiForegroundColorWhite stores int value for white foreground
const AnsiForegroundColorYellow int = 33
AnsiForegroundColorYellow stores int value for yellow foreground
const AnsiStyleBold int = 1
AnsiStyleBold stores int value for bold style
const AnsiStyleDim int = 2
AnsiStyleDim stores int value for dim style
const AnsiStyleItalic int = 3
AnsiStyleItalic stores int value for italic style
const AnsiStyleNormal int = 0
AnsiStyleNormal stores int value for normal style
const AnsiStyleStrikethrough int = 9
AnsiStyleStrikethrough stores int value for strikethrough style
const AnsiStyleUnderline int = 4
AnsiStyleUnderline stores int value for underline style
const DockerCompose string = "docker-compose.yml"
DockerCompose stores the default name of a docker compose file.
const GantryDef string = "gantry.def.yml"
GantryDef stores the default name of a gantry definition.
const GantryEnv string = "gantry.env.yml"
GantryEnv stores the default name of a gantry environment.
const GenericStringFormat string = "\u001b[%sm%s\u001b[0m"
GenericStringFormat provides formatting for a single string enclodes in ANSI formatting tags.
const PrefixedWriterFormat string = "%s\u001b[0m %s\u001b[0m"
PrefixedWriterFormat provides formatting for to space separated strings resetting ANSI formatting after each string.
Variables ¶
var ( // Version of the program Version = "no-version" // Verbose is a global verbosity flag Verbose = false // ProjectName stores the global prefix for networks and containers. ProjectName = "" // ForceWharfer is a global flag to force the usage of wharfer even // if the user could use docker directly. ForceWharfer = false )
Functions ¶
func ApplyAnsiStyle ¶
ApplyAnsiStyle applies ansi integer styles to text
func BuildAnsiStyle ¶
BuildAnsiStyle combines style integers with ;
func GetNextFriendlyColor ¶
func GetNextFriendlyColor() int
GetNextFriendlyColor returns the next friendly color from the global friendlyColors store.
func NewContainerKiller ¶
func NewContainerRemover ¶
func NewContainerRunner ¶
func NewImageBuilder ¶
func NewImagePuller ¶
func NewNetworkCreator ¶
func NewNetworkRemover ¶
Types ¶
type BuildInfo ¶
type BuildInfo struct { Context string `json:"context"` Dockerfile string `json:"dockerfile"` Args types.MappingWithEquals `json:"args"` }
BuildInfo represents the build-keyword in a docker-compse.yml.
type ColorStore ¶
type ColorStore struct {
// contains filtered or unexported fields
}
ColorStore provides a synced looping stylelist.
func NewColorStore ¶
func NewColorStore(colors []int) *ColorStore
NewColorStore creates a ColorStore for the provided list of styles.
func (*ColorStore) NextColor ¶
func (c *ColorStore) NextColor() int
NextColor returns the next color. Loops if list is exhausted.
type Executable ¶
type LocalRunner ¶
type LocalRunner struct {
// contains filtered or unexported fields
}
Local host
func NewLocalRunner ¶
func (*LocalRunner) Exec ¶
func (r *LocalRunner) Exec() error
func (*LocalRunner) Output ¶
func (r *LocalRunner) Output() ([]byte, error)
func (*LocalRunner) SetCommand ¶
func (r *LocalRunner) SetCommand(name string, args []string)
type LogSettings ¶
type LogSettings struct { }
type Pipeline ¶
type Pipeline struct { Definition *PipelineDefinition Environment *PipelineEnvironment NetworkName string }
Pipeline stores all definitions and settings regarding a deployment.
func NewPipeline ¶
func NewPipeline(definitionPath, environmentPath string, environment types.MappingWithEquals, ignoredSteps types.StringSet, selectedSteps types.StringSet) (*Pipeline, error)
NewPipeline creates a new Pipeline from given files which ignores the existence of steps with names provided in ignoreSteps.
func (Pipeline) BuildImages ¶
BuildImages builds all buildable images of Pipeline p in parallel.
func (Pipeline) CreateNetwork ¶
CreateNetwork creates a network using the NetworkName of the Pipeline p.
func (Pipeline) ExecuteSteps ¶
ExecuteSteps runs all not ignored steps/services in the order defined by there dependencies. Each step/service is run as soon as possible.
func (Pipeline) KillContainers ¶
KillContainers kills all running containers of Pipeline p.
func (Pipeline) PullImages ¶
PullImages pulls all pullable images of Pipeline p in parallel.
func (Pipeline) RemoveContainers ¶
RemoveContainers removes all stopped containers of Pipeline p.
func (Pipeline) RemoveNetwork ¶
RemoveNetwork removes the network of Pipeline p.
func (Pipeline) RemoveTempDirData ¶
RemoveTempDirData deletes all data stored in temporary directories.
type PipelineDefinition ¶
type PipelineDefinition struct { Version string Steps StepList // contains filtered or unexported fields }
PipelineDefinition stores docker-compose services and gantry steps.
func NewPipelineDefinition ¶
func NewPipelineDefinition(path string, env *PipelineEnvironment) (*PipelineDefinition, error)
func (*PipelineDefinition) Pipelines ¶
func (p *PipelineDefinition) Pipelines() (*Pipelines, error)
Pipelines calculates and verifies dependencies and ordering for steps defined in the PipelineDefinition p.
func (*PipelineDefinition) UnmarshalJSON ¶
func (r *PipelineDefinition) UnmarshalJSON(data []byte) error
UnmarshalJSON loads a PipelineDefinition from json using the pipelineJson struct.
type PipelineEnvironment ¶
type PipelineEnvironment struct { Version string LogSettings LogSettings Substitutions types.MappingWithEquals TempDirPath string TempDirNoAutoClean bool Steps ServiceMetaList ProjectName string // contains filtered or unexported fields }
PipelineEnvironment stores additional data for pipelines and steps.
func NewPipelineEnvironment ¶
func NewPipelineEnvironment(path string, substitutions types.MappingWithEquals, ignoredSteps types.StringSet, selectedSteps types.StringSet) (*PipelineEnvironment, error)
NewPipelineEnvironment builds a new environment merging the current environment, the environment given by path and the user provided steps to ignore.
func (*PipelineEnvironment) ApplyTo ¶
func (e *PipelineEnvironment) ApplyTo(rawFile []byte) ([]byte, error)
ApplyTo executes the environment template parser on the provided data.
func (*PipelineEnvironment) CleanUp ¶
func (e *PipelineEnvironment) CleanUp(signal os.Signal)
CleanUp tries to remove all managed temporary files and directories.
func (*PipelineEnvironment) UnmarshalJSON ¶
func (r *PipelineEnvironment) UnmarshalJSON(data []byte) error
UnmarshalJSON loads a PipelineDefinition from json using the pipelineJson struct.
type Pipelines ¶
type Pipelines [][]Step
Pipelines stores parallel and dependent steps/services.
type PrefixedLogger ¶
type PrefixedLogger struct {
// contains filtered or unexported fields
}
func NewPrefixedLogger ¶
func NewPrefixedLogger(prefix string, logger *log.Logger) *PrefixedLogger
func (*PrefixedLogger) Printf ¶
func (p *PrefixedLogger) Printf(format string, v ...interface{})
func (*PrefixedLogger) Println ¶
func (p *PrefixedLogger) Println(v ...interface{})
type PrefixedWriter ¶
type PrefixedWriter struct {
// contains filtered or unexported fields
}
func NewPrefixedWriter ¶
func NewPrefixedWriter(prefix string, target io.Writer) *PrefixedWriter
func (*PrefixedWriter) Output ¶
func (p *PrefixedWriter) Output() error
type Runner ¶
type Runner interface { Executable SetCommand(name string, args []string) }
type Service ¶
type Service struct { BuildInfo BuildInfo `json:"build"` Command types.StringOrStringSlice `json:"command"` Entrypoint types.StringOrStringSlice `json:"entrypoint"` Image string `json:"image"` Ports []string `json:"ports"` Volumes []string `json:"volumes"` Environment types.MappingWithEquals `json:"environment"` DependsOn types.StringSet `json:"depends_on"` Restart string `json:"restart"` Name string Meta ServiceMeta // contains filtered or unexported fields }
Service provides a service definition from docker-compose.
func (Service) ColoredContainerName ¶
ColoredContainerName returns the container name of s with color applied.
func (Service) ColoredName ¶
ColoredName returns the name of s with color applied.
func (Service) ContainerName ¶
ContainerName returns the name for a container of s prefixed with the current project name.
func (Service) ImageName ¶
ImageName returns the name of the image of s. The name of the step is used if non is specified.
func (Service) RawContainerName ¶
RawContainerName returns the name for a container of s.
type ServiceKeepAlive ¶
type ServiceKeepAlive int
const ( KeepAliveYes ServiceKeepAlive = iota KeepAliveNo KeepAliveReplace )
func (*ServiceKeepAlive) UnmarshalJSON ¶
func (d *ServiceKeepAlive) UnmarshalJSON(b []byte) error
UnmarshalJSON sets *r to a copy of data.
type ServiceList ¶
ServiceList stores docker-compose service definitions as steps.
func (*ServiceList) UnmarshalJSON ¶
func (r *ServiceList) UnmarshalJSON(data []byte) error
UnmarshalJSON sets *r to a copy of data.
type ServiceLog ¶
type ServiceLog struct { Handler ServiceLogHandler `json:"handler"` Path string `json:"path"` // contains filtered or unexported fields }
func (*ServiceLog) Close ¶
func (l *ServiceLog) Close()
type ServiceLogHandler ¶
type ServiceLogHandler int
const ( LogHandlerStdout ServiceLogHandler = iota LogHandlerFile LogHandlerBoth LogHandlerDiscard )
func (*ServiceLogHandler) UnmarshalJSON ¶
func (d *ServiceLogHandler) UnmarshalJSON(b []byte) error
type ServiceMeta ¶
type ServiceMeta struct { Ignore bool `json:"ignore"` IgnoreFailure bool `json:"ignore_failure"` KeepAlive ServiceKeepAlive `json:"keep_alive"` Stdout ServiceLog `json:"stdout"` Stderr ServiceLog `json:"stderr"` Selected bool Type ServiceType }
func (*ServiceMeta) Close ¶
func (m *ServiceMeta) Close()
func (*ServiceMeta) Open ¶
func (m *ServiceMeta) Open() error
Open handles output initialisation by setting defaults.
type ServiceMetaList ¶
type ServiceMetaList map[string]ServiceMeta
type ServiceType ¶
type ServiceType int
const ( ServiceTypeService ServiceType = iota ServiceTypeStep )
type Step ¶
type Step struct { Service Role string `json:"role"` After types.StringSet `json:"after"` Detach bool `json:"detach"` }
Step provides an extended service.
func (Step) BuildCommand ¶
BuildCommand returns the command to build a new image for s.
func (Step) Dependencies ¶
Dependencies returns all steps needed for running s.
func (Step) PullCommand ¶
PullCommand returns the command to pull the image for step s.
func (Step) RunCommand ¶
RunCommand returns the command to run an instance of step s.