builder

package
v0.0.0-...-352af58 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GeneratedPipeline string
View Source
var GroupNameToBlock = orderedmap.New()
View Source
var JobNameToBlock = orderedmap.New()
View Source
var ResourceNameToBlock = orderedmap.New()
View Source
var ResourceTypeNameToBlock = orderedmap.New()
View Source
var StepNameToBlock = orderedmap.New()
View Source
var TaskConfigNameToBlock = orderedmap.New()
View Source
var TaskImageNameToBlock = orderedmap.New()

Functions

This section is empty.

Types

type Group

type Group struct {
	Name      string     `yaml:"name,omitempty" validate:"required"`
	Jobs      []Job      `yaml:"jobs,omitempty"`
	Resources []Resource `yaml:"resources,omitempty"`
}

func (Group) Generate

func (g Group) Generate() string

func (Group) MarshalYAML

func (g Group) MarshalYAML() (interface{}, error)

func (*Group) UnmarshalYAML

func (g *Group) UnmarshalYAML(unmarshal func(interface{}) error) error

type InParallel

type InParallel struct {
	Limit    int   `yaml:"limit,omitempty"`
	FailFast bool  `yaml:"fail_fast,omitempty"`
	Steps    Steps `yaml:"steps,omitempty"`
}

type Job

type Job struct {
	Name                 string   `yaml:"name,omitempty"`
	Plan                 Steps    `yaml:"plan,omitempty"`
	Serial               bool     `yaml:"serial,omitempty"`
	SerialGroups         []string `yaml:"serial_groups,omitempty"`
	BuildLogsToRetain    int      `yaml:"build_logs_to_retain,omitempty"`
	MaxInFlight          int      `yaml:"max_in_flight,omitempty"` // TODO: make default 1
	Public               bool     `yaml:"public,omitempty"`
	DisableManualTrigger bool     `yaml:"disable_manual_trigger,omitempty"`
	Interruptible        bool     `yaml:"interruptible,omitempty"`
	OnSuccess            Step     `yaml:"on_success,omitempty"`
	OnFailure            Step     `yaml:"on_failure,omitempty"`
	OnAbort              Step     `yaml:"on_abort,omitempty"`
	Ensure               Step     `yaml:"ensure,omitempty"`
}

func (Job) Generate

func (j Job) Generate() string

func (*Job) UnmarshalYAML

func (j *Job) UnmarshalYAML(unmarshal func(interface{}) error) error

type Pipeline

type Pipeline struct {
	Name          string        `yaml:"name,omitempty"`
	ResourceTypes ResourceTypes `yaml:"resource_types,omitempty"`
	Resources     []Resource    `yaml:"resources,omitempty"`
	Jobs          []Job         `yaml:"jobs,omitempty"`
	Groups        []Group       `yaml:"groups,omitempty"`
}

func (Pipeline) Generate

func (p Pipeline) Generate() string

func (*Pipeline) UnmarshalYAML

func (p *Pipeline) UnmarshalYAML(unmarshal func(interface{}) error) error

type Resource

type Resource struct {
	Name         string                 `yaml:"name,omitempty"`
	Type         string                 `yaml:"type,omitempty"`
	Source       map[string]interface{} `yaml:"source,omitempty"`
	Version      interface{}            `yaml:"version,omitempty"`     // TODO: validate ("latest" | "every" | {version})
	CheckEvery   string                 `yaml:"check_every,omitempty"` // TODO: check is valid duration
	Tags         []string               `yaml:"tags,omitempty"`
	WebhookToken string                 `yaml:"webhook_token,omitempty"`
}

func (Resource) Generate

func (r Resource) Generate() string

type ResourceType

type ResourceType struct {
	Name       string                 `yaml:"name,omitempty" validate:"required"` // TODO: add validation later
	Type       string                 `yaml:"type,omitempty" validate:"required"`
	Source     map[string]interface{} `yaml:"source,omitempty"`
	Privileged bool                   `yaml:"privileged,omitempty"`
	Params     map[string]interface{} `yaml:"params,omitempty"`
	CheckEvery string                 `yaml:"check_every,omitempty"`
	Tags       []string               `yaml:"tags,omitempty"`
}

func (ResourceType) Generate

func (r ResourceType) Generate() string

type ResourceTypes

type ResourceTypes []ResourceType

type Step

type Step interface {
	StepType() string
	Generate() string
}

type StepAggregate

type StepAggregate struct {
	Aggregate Steps `yaml:"aggregate,omitempty"`
	StepHook  `yaml:",inline,omitempty"`
}

func (StepAggregate) Generate

func (s StepAggregate) Generate() string

func (StepAggregate) StepType

func (s StepAggregate) StepType() string

func (*StepAggregate) UnmarshalYAML

func (s *StepAggregate) UnmarshalYAML(unmarshal func(interface{}) error) error

type StepDo

type StepDo struct {
	Do       Steps `yaml:"do,omitempty"`
	StepHook `yaml:",inline,omitempty"`
}

func (StepDo) Generate

func (s StepDo) Generate() string

func (StepDo) StepType

func (s StepDo) StepType() string

func (*StepDo) UnmarshalYAML

func (s *StepDo) UnmarshalYAML(unmarshal func(interface{}) error) error

type StepGet

type StepGet struct {
	Get      string                 `yaml:"get,omitempty"`
	Resource string                 `yaml:"resource,omitempty"`
	Version  interface{}            `yaml:"version,omitempty"`
	Passed   []string               `yaml:"passed,omitempty"` //TODO: change to []Job?
	Params   map[string]interface{} `yaml:"params,omitempty"`
	Trigger  bool                   `yaml:"trigger,omitempty"`
	StepHook `yaml:",inline,omitempty"`
}

func (StepGet) Generate

func (s StepGet) Generate() string

func (StepGet) StepType

func (s StepGet) StepType() string

func (*StepGet) UnmarshalYAML

func (s *StepGet) UnmarshalYAML(unmarshal func(interface{}) error) error

type StepHook

type StepHook struct {
	OnSuccess Step     `yaml:"on_success,omitempty"`
	OnFailure Step     `yaml:"on_failure,omitempty"`
	OnAbort   Step     `yaml:"on_abort,omitempty"`
	Ensure    Step     `yaml:"ensure,omitempty"`
	Tags      []string `yaml:"tags,omitempty"`
	Timeout   string   `yaml:"timeout,omitempty"` // TODO: validate time duration
	Attempts  int      `yaml:"attempts,omitempty"`
}

TODO: add validation for all step structs

func (*StepHook) UnmarshalYAML

func (s *StepHook) UnmarshalYAML(unmarshal func(interface{}) error) error

Due to the implementation of yaml:",inline", the inlined struct's field is processed as if they are the fields of the outer struct. Which means the custom unmarshal rule of the inlined StepHook struct will not be applied automatically. Thus when unmarshaling steps, the following unmarshal rule needs to be applied manually in each step's custom unmarshal rule.

type StepInParallel

type StepInParallel struct {
	InParallel InParallel `yaml:"in_parallel,omitempty"`
	StepHook   `yaml:",inline,omitempty"`
}

func (StepInParallel) Generate

func (s StepInParallel) Generate() string

func (StepInParallel) StepType

func (s StepInParallel) StepType() string

func (*StepInParallel) UnmarshalYAML

func (s *StepInParallel) UnmarshalYAML(unmarshal func(interface{}) error) error

type StepPut

type StepPut struct {
	Put       string                 `yaml:"put,omitempty"`
	Resource  string                 `yaml:"resource,omitempty"`
	Params    map[string]interface{} `yaml:"params,omitempty"`
	GetParams map[string]interface{} `yaml:"get_params,omitempty"`
	StepHook  `yaml:",inline,omitempty"`
}

func (StepPut) Generate

func (s StepPut) Generate() string

func (StepPut) StepType

func (s StepPut) StepType() string

func (*StepPut) UnmarshalYAML

func (s *StepPut) UnmarshalYAML(unmarshal func(interface{}) error) error

type StepTask

type StepTask struct {
	Task          string                 `yaml:"task,omitempty"`
	Config        *TaskConfig            `yaml:"config,omitempty"` // TODO: validate config and file can have only one set
	File          string                 `yaml:"file,omitempty"`
	Privileged    bool                   `yaml:"privileged,omitempty"`
	Params        map[string]interface{} `yaml:"params,omitempty"`
	Image         string                 `yaml:"image,omitempty"`
	InputMapping  map[string]interface{} `yaml:"input_mapping,omitempty"`
	OutputMapping map[string]interface{} `yaml:"output_mapping,omitempty"`
	StepHook      `yaml:",inline,omitempty"`
}

func (StepTask) Generate

func (s StepTask) Generate() string

func (StepTask) StepType

func (s StepTask) StepType() string

func (*StepTask) UnmarshalYAML

func (s *StepTask) UnmarshalYAML(unmarshal func(interface{}) error) error

type StepTry

type StepTry struct {
	Try      Step `yaml:"try,omitempty"`
	StepHook `yaml:",inline,omitempty"`
}

func (StepTry) Generate

func (s StepTry) Generate() string

func (StepTry) StepType

func (s StepTry) StepType() string

func (*StepTry) UnmarshalYAML

func (s *StepTry) UnmarshalYAML(unmarshal func(interface{}) error) error

type Steps

type Steps []Step

func (*Steps) UnmarshalYAML

func (s *Steps) UnmarshalYAML(unmarshal func(interface{}) error) error

type TaskCache

type TaskCache struct {
	Path string `yaml:"path,omitempty"`
}

type TaskConfig

type TaskConfig struct {
	Platform      string                 `yaml:"platform,omitempty"`
	ImageResource *TaskImageResource     `yaml:"image_resource,omitempty"`
	RootfsUri     string                 `yaml:"rootfs_uri,omitempty"`
	Inputs        []TaskInput            `yaml:"inputs,omitempty"`
	Outputs       []TaskOutput           `yaml:"outputs,omitempty"`
	Caches        []TaskCache            `yaml:"caches,omitempty"`
	Run           *TaskRun               `yaml:"run,omitempty"`
	Params        map[string]interface{} `yaml:"params,omitempty"`
}

func (TaskConfig) Generate

func (t TaskConfig) Generate() string

type TaskImageResource

type TaskImageResource struct {
	Type    string                 `yaml:"type,omitempty"`
	Source  map[string]interface{} `yaml:"source,omitempty"`
	Params  map[string]interface{} `yaml:"params,omitempty"`
	Version map[string]interface{} `yaml:"version,omitempty"`
}

func (TaskImageResource) Generate

func (t TaskImageResource) Generate() string

type TaskInput

type TaskInput struct {
	Name     string `yaml:"name,omitempty"`
	Path     string `yaml:"path,omitempty"`
	Optional bool   `yaml:"optional,omitempty"`
}

type TaskOutput

type TaskOutput struct {
	Name string `yaml:"name,omitempty"`
	Path string `yaml:"path,omitempty"`
}

type TaskRun

type TaskRun struct {
	Path string   `yaml:"path,omitempty"`
	Args []string `yaml:"args,omitempty"`
	Dir  string   `yaml:"dir,omitempty"`
	User string   `yaml:"user,omitempty"`
}

Jump to

Keyboard shortcuts

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