dinghyfile

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2019 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Overview

Package dinghyfile is a generated GoMock package.

Package dinghyfile is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMalformedJSON is more specific than just returning 422.
	ErrMalformedJSON = errors.New("malformed json")
	DefaultEmail     = "unknown@unknown.com"
)

Functions

This section is empty.

Types

type DependencyManager

type DependencyManager interface {
	SetDeps(parent string, deps []string)
	GetRoots(child string) []string
}

DependencyManager is an interface for assigning dependencies and looking up root nodes

type DinghyJsonUnmarshaller

type DinghyJsonUnmarshaller struct{}

func (DinghyJsonUnmarshaller) Unmarshal

func (d DinghyJsonUnmarshaller) Unmarshal(data []byte, i interface{}) error

Unmarshal is wrapper around json.Unmarshal that returns user-friendly errors when there are syntax errors.

type Dinghyfile

type Dinghyfile struct {
	// Application name can be specified either in top-level "application" or as a key in "spec"
	// We don't want arbitrary application properties in the top-level Dinghyfile so we put them in .spec
	Application          string                 `json:"application" yaml:"application" hcl:"application"`
	ApplicationSpec      plank.Application      `json:"spec" yaml:"spec" hcl:"spec"`
	DeleteStalePipelines bool                   `json:"deleteStalePipelines" yaml:"deleteStalePipelines" hcl:"deleteStalePipelines"`
	Globals              map[string]interface{} `json:"globals" yaml:"globals" hcl:"globals"`
	Pipelines            []plank.Pipeline       `json:"pipelines" yaml:"pipelines" hcl:"pipelines"`
}

Dinghyfile is the format of the pipeline template JSON

func NewDinghyfile

func NewDinghyfile() Dinghyfile

type DinghyfileParser

type DinghyfileParser struct {
	Builder *PipelineBuilder
}

func NewDinghyfileParser

func NewDinghyfileParser(b *PipelineBuilder) *DinghyfileParser

func (*DinghyfileParser) Parse

func (r *DinghyfileParser) Parse(org, repo, path, branch string, vars []VarMap) (*bytes.Buffer, error)

Parse parses the template

func (*DinghyfileParser) SetBuilder

func (r *DinghyfileParser) SetBuilder(b *PipelineBuilder)

type Downloader

type Downloader interface {
	Download(org, repo, file, branch string) (string, error)
	EncodeURL(org, repo, file, branch string) string
	DecodeURL(url string) (string, string, string, string)
}

Downloader is an interface that fetches files from a source

type EventsTestClient

type EventsTestClient struct{}

mock out events so that it gets passed over and doesn't do anything

func (*EventsTestClient) SendEvent

func (c *EventsTestClient) SendEvent(eventType string, event *events.Event)

type MockDependencyManager

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

MockDependencyManager is a mock of DependencyManager interface

func NewMockDependencyManager

func NewMockDependencyManager(ctrl *gomock.Controller) *MockDependencyManager

NewMockDependencyManager creates a new mock instance

func (*MockDependencyManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockDependencyManager) GetRoots

func (m *MockDependencyManager) GetRoots(child string) []string

GetRoots mocks base method

func (*MockDependencyManager) SetDeps

func (m *MockDependencyManager) SetDeps(parent string, deps []string)

SetDeps mocks base method

type MockDependencyManagerMockRecorder

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

MockDependencyManagerMockRecorder is the mock recorder for MockDependencyManager

func (*MockDependencyManagerMockRecorder) GetRoots

func (mr *MockDependencyManagerMockRecorder) GetRoots(child interface{}) *gomock.Call

GetRoots indicates an expected call of GetRoots

func (*MockDependencyManagerMockRecorder) SetDeps

func (mr *MockDependencyManagerMockRecorder) SetDeps(parent, deps interface{}) *gomock.Call

SetDeps indicates an expected call of SetDeps

type MockDownloader

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

MockDownloader is a mock of Downloader interface

func NewMockDownloader

func NewMockDownloader(ctrl *gomock.Controller) *MockDownloader

NewMockDownloader creates a new mock instance

func (*MockDownloader) DecodeURL

func (m *MockDownloader) DecodeURL(url string) (string, string, string, string)

DecodeURL mocks base method

func (*MockDownloader) Download

func (m *MockDownloader) Download(org, repo, file, branch string) (string, error)

Download mocks base method

func (*MockDownloader) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockDownloader) EncodeURL

func (m *MockDownloader) EncodeURL(org, repo, file, branch string) string

EncodeURL mocks base method

type MockDownloaderMockRecorder

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

MockDownloaderMockRecorder is the mock recorder for MockDownloader

func (*MockDownloaderMockRecorder) DecodeURL

func (mr *MockDownloaderMockRecorder) DecodeURL(url interface{}) *gomock.Call

DecodeURL indicates an expected call of DecodeURL

func (*MockDownloaderMockRecorder) Download

func (mr *MockDownloaderMockRecorder) Download(org, repo, file, branch interface{}) *gomock.Call

Download indicates an expected call of Download

func (*MockDownloaderMockRecorder) EncodeURL

func (mr *MockDownloaderMockRecorder) EncodeURL(org, repo, file, branch interface{}) *gomock.Call

EncodeURL indicates an expected call of EncodeURL

type MockParser

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

MockParser is a mock of Parser interface

func NewMockParser

func NewMockParser(ctrl *gomock.Controller) *MockParser

NewMockParser creates a new mock instance

func (*MockParser) EXPECT

func (m *MockParser) EXPECT() *MockParserMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockParser) Parse

func (m *MockParser) Parse(org, repo, path, branch string, vars []VarMap) (*bytes.Buffer, error)

Parse mocks base method

func (*MockParser) SetBuilder

func (m *MockParser) SetBuilder(b *PipelineBuilder)

SetBuilder mocks base method

type MockParserMockRecorder

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

MockParserMockRecorder is the mock recorder for MockParser

func (*MockParserMockRecorder) Parse

func (mr *MockParserMockRecorder) Parse(org, repo, path, branch, vars interface{}) *gomock.Call

Parse indicates an expected call of Parse

func (*MockParserMockRecorder) SetBuilder

func (mr *MockParserMockRecorder) SetBuilder(b interface{}) *gomock.Call

SetBuilder indicates an expected call of SetBuilder

type MockPlankClient

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

MockPlankClient is a mock of PlankClient interface

func NewMockPlankClient

func NewMockPlankClient(ctrl *gomock.Controller) *MockPlankClient

NewMockPlankClient creates a new mock instance

func (*MockPlankClient) ArmoryEndpointsEnabled

func (m *MockPlankClient) ArmoryEndpointsEnabled() bool

ArmoryEndpointsEnabled mocks base method

func (*MockPlankClient) CreateApplication

func (m *MockPlankClient) CreateApplication(arg0 *plank.Application) error

CreateApplication mocks base method

func (*MockPlankClient) DeletePipeline

func (m *MockPlankClient) DeletePipeline(arg0 plank.Pipeline) error

DeletePipeline mocks base method

func (*MockPlankClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockPlankClient) EnableArmoryEndpoints

func (m *MockPlankClient) EnableArmoryEndpoints()

EnableArmoryEndpoints mocks base method

func (*MockPlankClient) GetApplication

func (m *MockPlankClient) GetApplication(arg0 string) (*plank.Application, error)

GetApplication mocks base method

func (*MockPlankClient) GetPipelines

func (m *MockPlankClient) GetPipelines(arg0 string) ([]plank.Pipeline, error)

GetPipelines mocks base method

func (*MockPlankClient) ResyncFiat

func (m *MockPlankClient) ResyncFiat() error

ResyncFiat mocks base method

func (*MockPlankClient) UpsertPipeline

func (m *MockPlankClient) UpsertPipeline(arg0 plank.Pipeline, arg1 string) error

UpsertPipeline mocks base method

type MockPlankClientMockRecorder

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

MockPlankClientMockRecorder is the mock recorder for MockPlankClient

func (*MockPlankClientMockRecorder) ArmoryEndpointsEnabled

func (mr *MockPlankClientMockRecorder) ArmoryEndpointsEnabled() *gomock.Call

ArmoryEndpointsEnabled indicates an expected call of ArmoryEndpointsEnabled

func (*MockPlankClientMockRecorder) CreateApplication

func (mr *MockPlankClientMockRecorder) CreateApplication(arg0 interface{}) *gomock.Call

CreateApplication indicates an expected call of CreateApplication

func (*MockPlankClientMockRecorder) DeletePipeline

func (mr *MockPlankClientMockRecorder) DeletePipeline(arg0 interface{}) *gomock.Call

DeletePipeline indicates an expected call of DeletePipeline

func (*MockPlankClientMockRecorder) EnableArmoryEndpoints

func (mr *MockPlankClientMockRecorder) EnableArmoryEndpoints() *gomock.Call

EnableArmoryEndpoints indicates an expected call of EnableArmoryEndpoints

func (*MockPlankClientMockRecorder) GetApplication

func (mr *MockPlankClientMockRecorder) GetApplication(arg0 interface{}) *gomock.Call

GetApplication indicates an expected call of GetApplication

func (*MockPlankClientMockRecorder) GetPipelines

func (mr *MockPlankClientMockRecorder) GetPipelines(arg0 interface{}) *gomock.Call

GetPipelines indicates an expected call of GetPipelines

func (*MockPlankClientMockRecorder) ResyncFiat

func (mr *MockPlankClientMockRecorder) ResyncFiat() *gomock.Call

ResyncFiat indicates an expected call of ResyncFiat

func (*MockPlankClientMockRecorder) UpsertPipeline

func (mr *MockPlankClientMockRecorder) UpsertPipeline(arg0, arg1 interface{}) *gomock.Call

UpsertPipeline indicates an expected call of UpsertPipeline

type Parser

type Parser interface {
	SetBuilder(b *PipelineBuilder)
	Parse(org, repo, path, branch string, vars []VarMap) (*bytes.Buffer, error)
}

type PipelineBuilder

type PipelineBuilder struct {
	Downloader           Downloader
	Depman               DependencyManager
	TemplateRepo         string
	TemplateOrg          string
	DinghyfileName       string
	Client               util.PlankClient
	DeleteStalePipelines bool
	AutolockPipelines    string
	EventClient          events.EventClient
	Parser               Parser
	Logger               log.FieldLogger
	Ums                  []Unmarshaller
	Notifiers            []notifiers.Notifier
}

PipelineBuilder is responsible for downloading dinghyfiles/modules, compiling them, and sending them to Spinnaker

func (*PipelineBuilder) AddUnmarshaller

func (b *PipelineBuilder) AddUnmarshaller(u Unmarshaller)

func (*PipelineBuilder) DetermineParser

func (b *PipelineBuilder) DetermineParser(path string) Parser

DetermineParser currently only returns a DinghyfileParser; it could return other types of parsers in the future (for example, MPTv2) If we can't discern the types based on the path passed here, we may need to revisit this. For now, this is just a stub that always returns the DinghyfileParser type.

func (*PipelineBuilder) GetPipelineByID

func (b *PipelineBuilder) GetPipelineByID(app, pipelineName string) (string, error)

GetPipelineByID returns a pipeline's UUID by its name; if the pipeline isn't found, one is created one and its ID is returned.

func (*PipelineBuilder) NotifyFailure

func (b *PipelineBuilder) NotifyFailure(org, repo, path string, err error)

func (*PipelineBuilder) NotifySuccess

func (b *PipelineBuilder) NotifySuccess(org, repo, path string)

func (*PipelineBuilder) PipelineIDs

func (b *PipelineBuilder) PipelineIDs(app string) (map[string]string, error)

PipelineIDs returns a map of pipeline names -> their UUID.

func (*PipelineBuilder) ProcessDinghyfile

func (b *PipelineBuilder) ProcessDinghyfile(org, repo, path, branch string) error

ProcessDinghyfile downloads a dinghyfile and uses it to update Spinnaker's pipelines.

func (*PipelineBuilder) RebuildModuleRoots

func (b *PipelineBuilder) RebuildModuleRoots(org, repo, path, branch string) error

RebuildModuleRoots rebuilds all dinghyfiles which are roots of the specified file

func (*PipelineBuilder) UpdateDinghyfile

func (b *PipelineBuilder) UpdateDinghyfile(dinghyfile []byte) (Dinghyfile, error)

UpdateDinghyfile doesn't actually update anything; it unmarshals the results bytestream into the Dinghyfile{} struct, and sets the name and email on the ApplicationSpec if it didn't get unmarshalled on its own.

type Unmarshaller

type Unmarshaller interface {
	Unmarshal(data []byte, i interface{}) error
}

type VarMap

type VarMap map[string]interface{}

Jump to

Keyboard shortcuts

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