func (g Group) ImageDescriptionRef(containerName string) *ImageDescriptionRef {
	return findImageDescription(containerName, g.ImageDescriptions)
}
ImageDescriptionRef implements ContainerScaffold
package config
import (
	"io"
	"io/ioutil"
	yaml "gopkg.in/yaml.v2"
)
func NewPipeline(r io.Reader) (*Pipeline, error) {
	content, err := ioutil.ReadAll(r)
	if err != nil {
		return nil, err
	}
	var p Pipeline
	if err := yaml.Unmarshal(content, &p); err != nil {
		return nil, err
	}
	return &p, nil
}
type Pipeline struct {
	Name              string             `yaml:"name"`
	Application       string             `yaml:"application"`
	Triggers          []Trigger          `yaml:"triggers"`
	Stages            []Stage            `yaml:"stages"`
	ImageDescriptions []ImageDescription `yaml:"imageDescriptions"`
	DisableConcurrentExecutions bool   `yaml:"disableConcurrentExecutions"`
	KeepQueuedPipelines         bool   `yaml:"keepQueuedPipelines"`
	Description                 string `yaml:"description"`
	Notifications []Notification `yaml:"notifications"`
	Parameters    []Parameter    `yaml:"parameters"`
}
type Parameter struct {
	Name        string   `yaml:"name"`
	Description string   `yaml:"description"`
	Default     string   `yaml:"default"`
	Required    bool     `yaml:"required"`
	Options     []Option `yaml:"options"`
}
type Option struct {
	Value string `yaml:"value"`
}
type ImageDescription struct {
	Name         string `yaml:"name"`
	Account      string `yaml:"account"`
	ImageID      string `yaml:"image_id"`
	Registry     string `yaml:"registry"`
	Repository   string `yaml:"repository"`
	Tag          string `yaml:"tag"`
	Organization string `yaml:"organization"`
}
type Trigger struct {
	Jenkins *JenkinsTrigger `yaml:"jenkins"`
	Webhook *WebhookTrigger `yaml:"webhook"`
}
type JenkinsTrigger struct {
	Job          string `yaml:"job"`
	Master       string `yaml:"master"`
	PropertyFile string `yaml:"propertyFile,omitempty"`
	Enabled      *bool  `yaml:"enabled"`
}
type JenkinsStage struct {
	Type string `yaml:"type,omitempty"`
	Job string `yaml:"job"`
	Parameters []PassthroughParameter `yaml:"parameters,omitempty"`
	Master string `yaml:"master"`
	CompleteOtherBranchesThenFail *bool `yaml:"completeOtherBranchesThenFail,omitempty"`
	ContinuePipeline              *bool `yaml:"continuePipeline,omitempty"`
	FailPipeline                  *bool `yaml:"failPipeline,omitempty"`
	MarkUnstableAsSuccessful      *bool `yaml:"markUnstableAsSuccessful,omitempty"`
	WaitForCompletion             *bool `yaml:"waitForCompletion,omitempty"`
}
type PassthroughParameter struct {
	Key   string `yaml:"key"`
	Value string `yaml:"value"`
}
type RunSpinnakerPipelineStage struct {
	Type string `yaml:"type,omitempty"`
	Job string `yaml:"job"`
	Application string `yaml:"application"`
	Pipeline    string `yaml:"pipeline"`
	PipelineParameters []PassthroughParameter `yaml:"parameters,omitempty"`
	CompleteOtherBranchesThenFail *bool `yaml:"completeOtherBranchesThenFail,omitempty"`
	ContinuePipeline              *bool `yaml:"continuePipeline,omitempty"`
	FailPipeline                  *bool `yaml:"failPipeline,omitempty"`
	MarkUnstableAsSuccessful      *bool `yaml:"markUnstableAsSuccessful,omitempty"`
	WaitForCompletion             *bool `yaml:"waitForCompletion,omitempty"`
	StageTimeoutMS                int64 `yaml:"stageTimeoutMs,omitempty"`
}
type WebhookTrigger struct {
	Enabled bool   `yaml:"enabled"`
	Source  string `yaml:"source"`
}
type WebHookStage struct {
	Name          string              `yaml:"name"`
	Description   string              `yaml:"description"`
	Method        string              `yaml:"method"`
	URL           string              `yaml:"url"`
	CustomHeaders map[string][]string `yaml:"customHeaders"`
	Payload       string              `yaml:"payload"`
}
type Stage struct {
	Account       string         `yaml:"account"`
	Name          string         `yaml:"name"`
	RefID         string         `yaml:"refId,omitempty"`
	ReliesOn      []string       `yaml:"reliesOn,omitempty"`
	Notifications []Notification `yaml:"notifications,omitempty"`
	Condition     string         `yaml:"condition,omitempty"`
	RunJob                  *RunJobStage               `yaml:"runJob,omitempty"`
	Deploy                  *DeployStage               `yaml:"deploy,omitempty"`
	ManualJudgement         *ManualJudgementStage      `yaml:"manualJudgement,omitempty"`
	DeployEmbeddedManifests *DeployEmbeddedManifests   `yaml:"deployEmbeddedManifests,omitempty"`
	DeleteEmbeddedManifest  *DeleteEmbeddedManifest    `yaml:"deleteEmbeddedManifest,omitempty"`
	ScaleManifest           *ScaleManifest             `yaml:"scaleManifest,omitempty"`
	WebHook                 *WebHookStage              `yaml:"webHook,omitempty"`
	Jenkins                 *JenkinsStage              `yaml:"jenkins,omitempty"`
	RunSpinnakerPipeline    *RunSpinnakerPipelineStage `yaml:"spinnaker,omitempty"`
}
type Notification struct {
	Address string            `yaml:"address"`
	Level   string            `yaml:"level"`
	Type    string            `yaml:"type"`
	When    []string          `yaml:"when"`
	Message map[string]string `yaml:"message"`
}
type Container struct {
	Command []string `yaml:"command"`
	Args    []string `yaml:"args"`
}
type RunJobStage struct {
	ManifestFile      string                `yaml:"manifestFile"`
	ImageDescriptions []ImageDescriptionRef `yaml:"imageDescriptions"`
	Container          *Container    `yaml:"container"`
	PodOverrides       *PodOverrides `yaml:"podOverrides,omitempty"`
	ServiceAccountName string        `yaml:"serviceAccountName"`
	DeleteJob          bool          `yaml:"deleteJob"`
}
type DeployStage struct {
	Groups []Group `yaml:"groups"`
}
type ImageDescriptionRef struct {
	Name          string `yaml:"name"`
	ContainerName string `yaml:"containerName"`
}
type Group struct {
	ManifestFile      string                `yaml:"manifestFile"`
	ImageDescriptions []ImageDescriptionRef `yaml:"imageDescriptions"`
	MaxRemainingASGS int      `yaml:"maxRemainingASGS"`
	ScaleDown        bool     `yaml:"scaleDown"`
	Stack            string   `yaml:"stack"`
	Details          string   `yaml:"details"`
	Strategy         string   `yaml:"strategy"`
	TargetSize       int      `yaml:"targetSize"`
	LoadBalancers    []string `yaml:"loadBalancers"`
	ContainerOverrides *ContainerOverrides `yaml:"containerOverrides"`
	PodOverrides *PodOverrides `yaml:"podOverrides,omitempty"`
}
type ManualJudgementStage struct {
	FailPipeline bool     `yaml:"failPipeline"`
	Instructions string   `yaml:"instructions"`
	Inputs       []string `yaml:"inputs"`
	Timeout      int      `yaml:"timeoutHours,omitempty"`
}
type ManifestFile struct {
	Environment string `yaml:"env,omitempty"`
	File        string `yaml:"file"`
}
type DeployEmbeddedManifests struct {
	DefaultMoniker     *Moniker              `yaml:"defaultMoniker,omitempty"`
	ConfiguratorFiles  []ManifestFile        `yaml:"configuratorFiles,omitempty"`
	Files              []ManifestFile        `yaml:"files"`
	ContainerOverrides []*ContainerOverrides `yaml:"containerOverrides,omitempty"`
	CompleteOtherBranchesThenFail *bool `yaml:"completeOtherBranchesThenFail,omitempty"`
	ContinuePipeline              *bool `yaml:"continuePipeline,omitempty"`
	FailPipeline                  *bool `yaml:"failPipeline,omitempty"`
	MarkUnstableAsSuccessful      *bool `yaml:"markUnstableAsSuccessful,omitempty"`
	WaitForCompletion             *bool `yaml:"waitForCompletion,omitempty"`
	StageTimeoutMS                int64 `yaml:"stageTimeoutMs,omitempty"`
}
type DeleteEmbeddedManifest struct {
	File string `yaml:"file"`
	CompleteOtherBranchesThenFail *bool `yaml:"completeOtherBranchesThenFail,omitempty"`
	ContinuePipeline              *bool `yaml:"continuePipeline,omitempty"`
	FailPipeline                  *bool `yaml:"failPipeline,omitempty"`
	MarkUnstableAsSuccessful      *bool `yaml:"markUnstableAsSuccessful,omitempty"`
	WaitForCompletion             *bool `yaml:"waitForCompletion,omitempty"`
}
type Moniker struct {
	App     string `yaml:"app"`
	Cluster string `yaml:"cluster"`
	Detail  string `yaml:"detail"`
	Stack   string `yaml:"stack"`
}
type ScaleManifest struct {
	Kind      string `yaml:"kind"`
	Name      string `yaml:"name"`
	Namespace string `yaml:"namespace"`
	Replicas  int    `yaml:"replicas"`
	CompleteOtherBranchesThenFail *bool `yaml:"completeOtherBranchesThenFail,omitempty"`
	ContinuePipeline              *bool `yaml:"continuePipeline,omitempty"`
	FailPipeline                  *bool `yaml:"failPipeline,omitempty"`
	MarkUnstableAsSuccessful      *bool `yaml:"markUnstableAsSuccessful,omitempty"`
	WaitForCompletion             *bool `yaml:"waitForCompletion,omitempty"`
}
type Resources struct {
	Requests *Resource `yaml:"requests,omitempty"`
	Limits   *Resource `yaml:"limits,omitempty"`
}
type Resource struct {
	Memory string `yaml:"memory,omitempty"`
	CPU    string `yaml:"cpu,omitempty"`
}
type ContainerOverrides struct {
	Name      string     `yaml:"name"`
	Args      []string   `yaml:"args,omitempty"`
	Command   []string   `yaml:"command,omitempty"`
	Resources *Resources `yaml:"resources,omitempty"`
}
type PodOverrides struct {
	Annotations map[string]string `yaml:"annotations,omitempty"`
}
type ContainerScaffold interface {
	GetTargetSize() int
	Manifest() string
	ImageDescriptionRef(containerName string) *ImageDescriptionRef
}
var _ ContainerScaffold = Group{}
var _ ContainerScaffold = RunJobStage{}
func (g Group) Manifest() string { return g.ManifestFile }