planner

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLIPlanner

type CLIPlanner struct {
	Logger         log.Logger
	Fs             afero.Afero
	UI             cli.Ui
	Viper          *viper.Viper
	Status         daemontypes.StatusReceiver
	BuilderBuilder *templates.BuilderBuilder

	Inline      inline.Renderer
	Helm        helm.Renderer
	Local       local.Renderer
	Docker      docker.Renderer
	DockerLayer *dockerlayer.Unpacker
	Web         web.Renderer
	GitHub      github.Renderer
	Terraform   terraform.Renderer
	AmazonEKS   amazoneks.Renderer
	GoogleGKE   googlegke.Renderer
	AzureAKS    azureaks.Renderer
}

CLIPlanner is the default Planner

func (*CLIPlanner) Build

func (p *CLIPlanner) Build(renderRoot string, assets []api.Asset, configGroups []libyaml.ConfigGroup, meta api.ReleaseMetadata, templateContext map[string]interface{}) (Plan, []string, error)

Build builds a plan in memory from assets+resolved config

func (*CLIPlanner) Execute

func (p *CLIPlanner) Execute(ctx context.Context, plan Plan) error

Execute executes the plan

type Factory

type Factory func() *CLIPlanner

func (Factory) Build

func (f Factory) Build(
	root string,
	assets []api.Asset,
	configGroups []libyaml.ConfigGroup,
	releaseMeta api.ReleaseMetadata,
	templateContext map[string]interface{},
) (Plan, []string, error)

func (Factory) Execute

func (f Factory) Execute(ctx context.Context, p Plan) error

func (Factory) WithStatusReceiver

func (f Factory) WithStatusReceiver(receiver daemontypes.StatusReceiver) Planner

type Plan

type Plan []Step

A Plan is a list of PlanSteps to execute

type Planner

type Planner interface {
	Build(
		string,
		[]api.Asset,
		[]libyaml.ConfigGroup,
		api.ReleaseMetadata,
		map[string]interface{},
	) (Plan, []string, error)

	Execute(context.Context, Plan) error

	WithStatusReceiver(receiver daemontypes.StatusReceiver) Planner
}

Planner is a thing that can plan and execute rendering

func NewFactory

func NewFactory(
	v *viper.Viper,
	logger log.Logger,
	fs afero.Afero,
	ui cli.Ui,
	builderBuilder *templates.BuilderBuilder,
	inlineRenderer inline.Renderer,
	dockerRenderer docker.Renderer,
	helmRenderer helm.Renderer,
	localRenderer local.Renderer,
	dockerlayers *dockerlayer.Unpacker,
	gh github.Renderer,
	tf terraform.Renderer,
	webRenderer web.Renderer,
	amazonEKS amazoneks.Renderer,
	googleGKE googlegke.Renderer,
	azureAKS azureaks.Renderer,
	status daemontypes.StatusReceiver,
) Planner

Use a factory so we can create instances and override the StatusReceiver on those instances.

type Step

type Step struct {
	Description string `json:"description" yaml:"description" hcl:"description"`
	Dest        string `json:"dest" yaml:"dest" hcl:"dest"`
	Execute     func(ctx context.Context) error
	Err         error
}

A Execute describes a single unit of work that Ship will do to render the application

Jump to

Keyboard shortcuts

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