template

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Name string `yaml:"name"`
	Helm *struct {
		Chart   string `yaml:"chart"`
		Repo    string `yaml:"repo"`
		Version string `yaml:"version"`
	} `yaml:"helm,omitempty"`
}

An App is a deployable application within a template

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
	App *struct {
		Name      string `yaml:"name"`
		Cluster   string `yaml:"cluster"`
		Namespace string `yaml:"namespace"`
		Helm      *struct {
			Command string `yaml:"command"`
			Wait    bool   `yaml:"wait"`
			Version int    `yaml:"version"`
			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"`
	} `yaml:"app,omitempty"`

	Test *struct {
		Name      string `yaml:"name"`
		Cluster   string `yaml:"cluster"`
		Namespace string `yaml:"namespace"`
	} `yaml:"test,omitempty"`

	Approval *struct {
		Groups []string `yaml:"groups"`
		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 {
	Version string `yaml:"version"`

	Clusters []string `yaml:"clusters"`

	Apps *[]App `yaml:"apps,omitempty"`

	Tests []struct {
		Name string `yaml:"name"`
		Helm *struct {
			Name    string `yaml:"name"`
			Timeout string `yaml:"timeout"`
		} `yaml:"helm,omitempty"`
	} `yaml:"tests,omitempty"`

	Triggers *[]struct {
		Deployment *struct {
			Name string `yaml:"name"`
		} `yaml:"deployment,omitempty"`
		Web *struct {
			Name string `yaml:"name"`
		} `yaml:"web,omitempty"`
		Manual *struct {
			Groups []string `yaml:"groups"`
			Users  []string `yaml:"users"`
		} `yaml:"manual,omitempty"`
	} `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 is how a deployment can verify structural correctness before execution

Jump to

Keyboard shortcuts

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