template

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application added in v0.8.6

type Application struct {
	Name    string `yaml:"name"`
	PartOf  string `yaml:"partOf"`
	Version string `yaml:"version"`
}

An Application is a way to link deployments to applications

type Engine

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

The Engine is the worker that performs all templating steps

func NewEngine

func NewEngine(g git.Agent, r *repo.ReadRepository) *Engine

NewEngine initializes the engine with required dependencies

func (*Engine) Run

func (e *Engine) Run(f []byte, v []byte) (*Template, error)

Run performs all templating steps with the given file contents

func (*Engine) Template

func (e *Engine) Template(f []byte) (string, error)

Template performs all templating steps save the final values substitution and unmarshal

type Step

type Step struct {
	// metadata/execution information
	Name      string `yaml:"name"`
	Hold      string `yaml:"hold"`
	Condition string `yaml:"condition"`

	// step information
	Helm *struct {
		Name      string             `yaml:"name"`
		Selector  *map[string]string `yaml:"selector,omitempty"`
		Cluster   string             `yaml:"cluster"`
		Namespace string             `yaml:"namespace"`
		Command   string             `yaml:"command"`
		Chart     *struct {
			Name    string `yaml:"name"`
			Repo    string `yaml:"repo"`
			Version string `yaml:"version"`
		} `yaml:"chart,omitempty"`
		Options *struct {
			RollbackVersion int    `yaml:"rollbackVersion"`
			Wait            bool   `yaml:"wait"`
			Install         bool   `yaml:"install"`
			Timeout         string `yaml:"timeout"`
			ReuseValues     bool   `yaml:"reuseValues"`
		} `yaml:"options"`
		Values *struct {
			Library *struct {
				Chart   string `yaml:"chart"`
				Repo    string `yaml:"repo"`
				Version string `yaml:"version"`
				File    string `yaml:"file"`
			} `yaml:"library,omitempty"`
			Raw *map[string]interface{} `yaml:"raw,omitempty"`
		} `yaml:"values,omitempty"`
	} `yaml:"helm,omitempty"`

	Approval *struct {
		Roles []string `yaml:"roles"`
		Users []string `yaml:"users"`
	} `yaml:"approval,omitempty"`

	Trigger *struct {
		Name       string                 `yaml:"name"`
		Deployment string                 `yaml:"deployment"`
		Arguments  map[string]interface{} `yaml:"arguments,omitempty"`
	} `yaml:"trigger,omitempty"`
}

A Step is an individual step within a Strategy

type Substitution

type Substitution struct {
	Name      string                  `yaml:"template"`
	Branch    string                  `yaml:"branch"`
	Repo      string                  `yaml:"repo"`
	Arguments *map[string]interface{} `yaml:"arguments,omitempty"`
}

A Substitution is the yaml syntax used to substitute yaml from another file

type Template

type Template struct {
	Name        string       `yaml:"name"`
	Version     string       `yaml:"version"`
	Application *Application `yaml:"apps,omitempty"`
	Links       []struct {
		Name string `yaml:"name"`
		URL  string `yaml:"url"`
	} `yaml:"links"`
	Triggers *[]Trigger `yaml:"triggers,omitempty"`
	Strategy *[]Step    `yaml:"strategy,omitempty"`
}

A Template is the go type representing yaml for a cd object

func (*Template) Validate

func (t *Template) Validate() []error

Validate checks a template for correctness so we can catch obvious error early

type Trigger added in v0.7.0

type Trigger struct {
	Deployment *struct {
		Name string `yaml:"name"`
	} `yaml:"deployment,omitempty"`
	Web *struct {
		Name string `yaml:"name"`
	} `yaml:"web,omitempty"`
	Manual *struct {
		Name  string   `yaml:"name"`
		Role  string   `yaml:"role"`
		Users []string `yaml:"users"`
	} `yaml:"manual,omitempty"`
}

A Trigger is a way of validating how this deployment is run

type ValidationError added in v0.8.6

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

ValidationError is an error found when validating this template

func (ValidationError) Error added in v0.8.6

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

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