v1

package
v0.0.0-...-80cfa99 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultGrace = 0

DefaultGrace Default grace period in seconds

View Source
const DefaultInterval = 10

DefaultInterval Default interval in seconds

View Source
const DefaultRetries = 3

DefaultRetries Default number of retries

View Source
const DefaultTimeout = 10

DefaultTimeout Default timeout in seconds

View Source
const WorkflowsCustomResource = WorkflowsPluralName + "." + WorkflowsGroupName

WorkflowsCustomResource Name of custom resource for workflows

View Source
const WorkflowsGroupName = "stack.foundation"

WorkflowsGroupName Group name for workflows

View Source
const WorkflowsGroupVersion = "v1"

WorkflowsGroupVersion Group version for workflows

View Source
const WorkflowsKind = "Workflow"

WorkflowsKind Kind for workflows

View Source
const WorkflowsPluralName = "workflows"

WorkflowsPluralName Plural form of name for workflows

View Source
const WorkflowsSingularName = "workflows"

WorkflowsSingularName Singular form of name for workflows

Variables

View Source
var SchemeGroupVersion = schema.GroupVersion{
	Group:   WorkflowsGroupName,
	Version: WorkflowsGroupVersion,
}

SchemeGroupVersion Workflows GroupVersion

Functions

func CollectVariables

func CollectVariables(variables []VariableSource) *properties.Properties

CollectVariables Collect all the variables from the specified sources

func GenerateCachedScriptName

func GenerateCachedScriptName(content string) string

GenerateCachedScriptName Generates a name for a cached step script

func GenerateChangeID

func GenerateChangeID() string

GenerateChangeID Generates an ID for a change

func GenerateContainerName

func GenerateContainerName() string

GenerateContainerName Generates a name for a step container

func GenerateImageName

func GenerateImageName() string

GenerateImageName Generates a name for a step image

func GeneratePodName

func GeneratePodName() string

GeneratePodName Generates a name for a pod

func GenerateScriptName

func GenerateScriptName() string

GenerateScriptName Generates a name for a step script

func GenerateServiceAssociation

func GenerateServiceAssociation() string

GenerateServiceAssociation Generates an association key between a service and a pod

func GenerateServiceName

func GenerateServiceName() string

GenerateServiceName Generates a service name

func GenerateVolumeName

func GenerateVolumeName() string

GenerateVolumeName Generates a name for a step volume

func GenerateWorkflowID

func GenerateWorkflowID() string

GenerateWorkflowID Generates an ID for a workflow

Types

type Change

type Change struct {
	ID           string     `json:"id" yaml:"id"`
	Type         ChangeType `json:"type" yaml:"type"`
	Handled      bool       `json:"handled" yaml:"handled"`
	StepSelector []int      `json:"step" yaml:"step"`
}

Change A workflow change

func NewChange

func NewChange(selector []int) *Change

NewChange Create a new unhandled change, with a generated ID

type ChangeType

type ChangeType string

ChangeType Type of change

const StepDone ChangeType = "stepDone"

StepDone A parallel or service step is done

const StepImageBuilt ChangeType = "stepImageBuilt"

StepImageBuilt Image for step has been built

const StepReady ChangeType = "stepReady"

StepReady A parallel or service step is ready

const StepStarted ChangeType = "stepStarted"

StepStarted A step was started

const WorkflowWait ChangeType = "workflowWait"

WorkflowWait A step is waiting for a workflow

const WorkflowWaitDone ChangeType = "workflowWaitDone"

WorkflowWaitDone Wait for a workflow to complete is done

type CherryPick

type CherryPick struct {
	Step string `json:"step" yaml:"step"`
	From string `json:"from" yaml:"from"`
	To   string `json:"to" yaml:"to"`
}

CherryPick Cherry pick a single location

type CompoundStepOptions

type CompoundStepOptions struct {
	StepOptions `json:",inline" yaml:",inline"`

	Steps []WorkflowStep `json:"steps" yaml:"steps"`
}

CompoundStepOptions Options for compound steps

type ExternalStepOptions

type ExternalStepOptions struct {
	StepOptions `json:",inline" yaml:",inline"`

	Parallel  string          `json:"parallel" yaml:"parallel"`
	Variables VariableOptions `json:"variables" yaml:"variables"`
	Workflow  string          `json:"workflow" yaml:"workflow"`
}

ExternalStepOptions Options for external steps

type GeneratorStepOptions

type GeneratorStepOptions struct {
	ScriptStepOptions `json:",inline" yaml:",inline"`

	Parallel  string          `json:"parallel" yaml:"parallel"`
	Variables VariableOptions `json:"variables" yaml:"variables"`
}

GeneratorStepOptions Options for a generator step

type HTTPHeader

type HTTPHeader struct {
	Name  string `json:"name" yaml:"name"`
	Value string `json:"value" yaml:"value"`
}

HTTPHeader HTTP header to send in health check

type HTTPHealthCheckOptions

type HTTPHealthCheckOptions struct {
	HealthCheckOptions `json:",inline" yaml:",inline"`

	Headers []HTTPHeader `json:"headers" yaml:"headers"`
	Path    string       `json:"path" yaml:"path"`
	Port    string       `json:"port" yaml:"port"`
}

HTTPHealthCheckOptions Options for HTTP/HTTPS health checks

type HealthCheck

type HealthCheck struct {
	HTTP   *HTTPHealthCheckOptions   `json:"http" yaml:"http"`
	HTTPS  *HTTPHealthCheckOptions   `json:"https" yaml:"https"`
	TCP    *TCPHealthCheckOptions    `json:"tcp" yaml:"tcp"`
	Script *ScriptHealthCheckOptions `json:"script" yaml:"script"`
}

HealthCheck Health check for a workflow step

func (*HealthCheck) SkipWait

func (c *HealthCheck) SkipWait() bool

SkipWait Is skip waiting configured for this check?

type HealthCheckOptions

type HealthCheckOptions struct {
	Grace    string `json:"grace" yaml:"grace"`
	Interval string `json:"interval" yaml:"interval"`
	Retries  string `json:"retries" yaml:"retries"`
	SkipWait string `json:"skipWait" yaml:"skipWait"`
	Timeout  string `json:"timeout" yaml:"timeout"`
}

HealthCheckOptions Base options for health checks

type Pick

type Pick struct {
	GeneratedBaseImage string   `json:"baseImage" yaml:"baseImage"`
	Copies             []string `json:"copies" yaml:"copies"`
}

Pick Cherry picked files for a step

type Port

type Port struct {
	Protocol  string `json:"protocol" yaml:"protocol"`
	Name      string `json:"name" yaml:"name"`
	Container string `json:"container" yaml:"container"`
	External  string `json:"external" yaml:"external"`
	Internal  string `json:"internal" yaml:"internal"`
}

Port An exposed port

type RunStepOptions

type RunStepOptions struct {
	ScriptStepOptions `json:",inline" yaml:",inline"`

	Cache    string `json:"cache" yaml:"cache"`
	Parallel string `json:"parallel" yaml:"parallel"`
}

RunStepOptions Options for a run step

type ScriptHealthCheckOptions

type ScriptHealthCheckOptions struct {
	HealthCheckOptions `json:",inline" yaml:",inline"`

	Path string `json:"path" yaml:"path"`
}

ScriptHealthCheckOptions Options for script health checks

type ScriptStepOptions

type ScriptStepOptions struct {
	StepOptions `json:",inline" yaml:",inline"`

	// CherryPick  []CherryPick     `json:"cherryPick" yaml:"cherryPick"`
	Dockerfile  string           `json:"dockerfile" yaml:"dockerfile"`
	Environment []VariableSource `json:"environment" yaml:"environment"`
	Image       string           `json:"image" yaml:"image"`
	Script      string           `json:"script" yaml:"script"`
	Source      SourceOptions    `json:"source" yaml:"source"`
	Step        string           `json:"step" yaml:"step"`
	Volumes     []Volume         `json:"volumes" yaml:"volumes"`
}

ScriptStepOptions Options for script-based steps

type ServiceStepOptions

type ServiceStepOptions struct {
	ScriptStepOptions `json:",inline" yaml:",inline"`

	Grace     string       `json:"grace" yaml:"grace"`
	Health    *HealthCheck `json:"health" yaml:"health"`
	Ports     []Port       `json:"ports" yaml:"ports"`
	Readiness *HealthCheck `json:"readiness" yaml:"readiness"`
}

ServiceStepOptions Options for a service step

type SourceOptions

type SourceOptions struct {
	Dockerignore string   `json:"dockerignore" yaml:"dockerignore"`
	Exclude      []string `json:"exclude" yaml:"exclude"`
	Include      []string `json:"include" yaml:"include"`
	Location     string   `json:"location" yaml:"location"`
	Omit         string   `json:"omit" yaml:"omit"`
}

SourceOptions Source options for a step

func (*SourceOptions) OmitsSource

func (s *SourceOptions) OmitsSource() bool

OmitsSource Does the specified source options omit source?

type StepOptions

type StepOptions struct {
	Name             string `json:"name" yaml:"name"`
	IgnoreFailure    *bool  `json:"ignoreFailure" yaml:"ignoreFailure"`
	IgnoreMissing    *bool  `json:"ignoreMissing" yaml:"ignoreMissing"`
	IgnoreValidation *bool  `json:"ignoreValidation" yaml:"ignoreValidation"`
}

StepOptions Options for all types of steps

func (*StepOptions) StepName

func (s *StepOptions) StepName(selector []int) string

StepName Returns the name based on step options

type StepState

type StepState struct {
	GeneratedBaseImage string `json:"baseImage" yaml:"baseImage"`
	GeneratedImage     string `json:"generatedImage" yaml:"generatedImage"`
	GeneratedContainer string `json:"generatedContainer" yaml:"generatedContainer"`
	GeneratedScript    string `json:"generatedScript" yaml:"generatedScript"`
	GeneratedWorkflow  string `json:"generatedWorkflow" yaml:"generatedWorkflow"`
	Picks              []Pick `json:"picks" yaml:"picks"`
	Ready              bool   `json:"ready" yaml:"ready"`
	Done               bool   `json:"done" yaml:"done"`
	Prepared           bool   `json:"prepared" yaml:"prepared"`
}

StepState State of step

type TCPHealthCheckOptions

type TCPHealthCheckOptions struct {
	HealthCheckOptions `json:",inline" yaml:",inline"`

	Port string `json:"port" yaml:"port"`
}

TCPHealthCheckOptions Options for TCP health checks

type VariableOptions

type VariableOptions struct {
	Exclude []string `json:"exclude" yaml:"exclude"`
	Include []string `json:"include" yaml:"include"`
}

VariableOptions Variable options for a step

type VariableSource

type VariableSource struct {
	File  string `json:"file" yaml:"file"`
	Name  string `json:"name" yaml:"name"`
	Value string `json:"value" yaml:"value"`
}

VariableSource A source of a variable

type Volume

type Volume struct {
	HostPath  string `json:"hostPath" yaml:"hostPath"`
	MountPath string `json:"mountPath" yaml:"mountPath"`
	Name      string `json:"name" yaml:"name"`
}

Volume Volume to mount for a workflow step

type Workflow

type Workflow struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata"`
	Spec              WorkflowSpec `json:"spec"`
}

Workflow Custom workflow resource

func ParseWorkflow

func ParseWorkflow(projectRoot, workflowName string, content []byte) (*Workflow, error)

ParseWorkflow Parse the given workflow content

func (*Workflow) AppendChange

func (w *Workflow) AppendChange(c *Change) *Change

AppendChange Add a new change to this workflow

func (*Workflow) IncrementStepSelector

func (w *Workflow) IncrementStepSelector(selector []int) []int

IncrementStepSelector Increment the given step selector, taking into account compound steps

func (*Workflow) MarkHandled

func (w *Workflow) MarkHandled(c *Change)

MarkHandled Mark the specified change in the workflow as handled

func (*Workflow) NextUnhandled

func (w *Workflow) NextUnhandled() *Change

NextUnhandled Get the next unhandled change in workflow

func (*Workflow) Parent

func (w *Workflow) Parent(selector []int) *WorkflowStep

Parent Get parent step of specified step

func (*Workflow) Select

func (w *Workflow) Select(selector []int) *WorkflowStep

Select Select a workflow step

type WorkflowList

type WorkflowList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`
	Items           []Workflow `json:"items"`
}

WorkflowList List of workflows

type WorkflowSpec

type WorkflowSpec struct {
	State            WorkflowState    `json:"state" yaml:"state"`
	Steps            []WorkflowStep   `json:"steps" yaml:"steps"`
	Variables        []VariableSource `json:"variables" yaml:"variables"`
	IgnoreMissing    bool             `json:"ignoreMissing" yaml:"ignoreMissing"`
	IgnoreValidation bool             `json:"ignoreValidation" yaml:"ignoreValidation"`
	IgnoreFailure    bool             `json:"ignoreFailure" yaml:"ignoreFailure"`
}

WorkflowSpec Specification of workflow

type WorkflowState

type WorkflowState struct {
	ID          string                 `json:"id" yaml:"id"`
	ProjectRoot string                 `json:"projectRoot" yaml:"projectRoot"`
	Variables   *properties.Properties `json:"-" yaml:"-"`
	Changes     []Change               `json:"changes" yaml:"changes"`
	Step        []int                  `json:"step" yaml:"step"`
}

WorkflowState State of workflow in K8s

type WorkflowStep

type WorkflowStep struct {
	Compound  *CompoundStepOptions  `json:"compound" yaml:"compound"`
	External  *ExternalStepOptions  `json:"external" yaml:"external"`
	Generator *GeneratorStepOptions `json:"generator" yaml:"generator"`
	Run       *RunStepOptions       `json:"run" yaml:"run"`
	Service   *ServiceStepOptions   `json:"service" yaml:"service"`
	State     StepState             `json:"state" yaml:"state"`
}

WorkflowStep Step within a workflow

func (*WorkflowStep) Cached

func (s *WorkflowStep) Cached() bool

Cached Is the step cached?

func (*WorkflowStep) CherryPick

func (s *WorkflowStep) CherryPick() []CherryPick

CherryPick Get the cherry picked files for this step, if it has any

func (*WorkflowStep) Dockerfile

func (s *WorkflowStep) Dockerfile() string

Dockerfile Get the Dockerfile for this step, if it has one

func (*WorkflowStep) Environment

func (s *WorkflowStep) Environment() []VariableSource

Environment Get the environment variables for this step, if it has any

func (*WorkflowStep) HasDockerfile

func (s *WorkflowStep) HasDockerfile() bool

HasScript Does step have a dockerfile?

func (*WorkflowStep) HasScript

func (s *WorkflowStep) HasScript() bool

HasScript Does step have a script to run?

func (*WorkflowStep) IgnoreFailure

func (s *WorkflowStep) IgnoreFailure() *bool

IgnoreFailure Is ignore failure enabled for this step?

func (*WorkflowStep) IgnoreMissing

func (s *WorkflowStep) IgnoreMissing() *bool

IgnoreMissing Is ignore missing enabled for this step?

func (*WorkflowStep) IgnoreValidation

func (s *WorkflowStep) IgnoreValidation() *bool

IgnoreValidation Is ignore validation enabled for this step?

func (*WorkflowStep) Image

func (s *WorkflowStep) Image() string

Image Get the image for this step, if it has one

func (*WorkflowStep) IsAsync

func (s *WorkflowStep) IsAsync() bool

IsAsync Is this an async step (a paralell or service step that skips wait)?

func (*WorkflowStep) IsCompoundStepComplete

func (s *WorkflowStep) IsCompoundStepComplete() bool

IsCompoundStepComplete Is the compound step complete?

func (*WorkflowStep) IsGenerator

func (s *WorkflowStep) IsGenerator() bool

IsGenerator Is this a script generating step?

func (*WorkflowStep) IsServiceWithWait

func (s *WorkflowStep) IsServiceWithWait() bool

IsServiceWithWait Is this a service step that waits for readiness?

func (*WorkflowStep) Name

func (s *WorkflowStep) Name() string

Name Get the name of the step, if it has one

func (*WorkflowStep) RequiresBuild

func (s *WorkflowStep) RequiresBuild() bool

RequiresBuild Does the step require an image to be built (all except call steps)?

func (*WorkflowStep) Script

func (s *WorkflowStep) Script() string

Script Get the script for this step, if it has one

func (*WorkflowStep) ScriptlessImageBuild

func (s *WorkflowStep) ScriptlessImageBuild() bool

ScriptlessImageBuild Does the step require an image to be built but doesn't have a script?

func (*WorkflowStep) SetVolumes

func (s *WorkflowStep) SetVolumes(volumes []Volume)

SetVolumes Set the volumes for this step

func (*WorkflowStep) Source

func (s *WorkflowStep) Source() *SourceOptions

Source Get the source options for this step, if it has any

func (*WorkflowStep) Step

func (s *WorkflowStep) Step() string

Step Get the previous step for this step, if it has one

func (*WorkflowStep) StepName

func (s *WorkflowStep) StepName(selector []int) string

StepName Returns the name for a step

func (*WorkflowStep) StepOptions

func (s *WorkflowStep) StepOptions() *StepOptions

StepOptions Get the options for this step

func (*WorkflowStep) UsesPreviousStep

func (s *WorkflowStep) UsesPreviousStep() bool

UsesPreviousStep Does step use a previous step as it's base?

func (*WorkflowStep) Volumes

func (s *WorkflowStep) Volumes() []Volume

Volumes Get the volumes for this step, if it has any

Jump to

Keyboard shortcuts

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