Documentation ¶
Overview ¶
Package spinnaker - a `shore` backend implementation for Spinnaker APIs
An abstraction layer over Spinnaker communications, unifying the experience for `shore` developers when working with a `spinnaker` backend.
The abstraction implements the standard `shore-backend` interface from github.com/Autodesk/shore/pkg/backend/spinnaker
Index ¶
- Constants
- func NewCustomCliError(pipelineName string, application string, res *http.Response, err error) error
- type ApplicationControllerAPI
- type ApplicationControllerError
- type CustomCliError
- type CustomSpinCLI
- type CustomSpinClient
- func (cli *CustomSpinClient) Do(req *http.Request) ([]byte, *http.Response, error)
- func (cli *CustomSpinClient) ExecutePipeline(application, pipelineName string, args io.Reader) (*ExecutePipelineResponse, *http.Response, error)
- func (cli *CustomSpinClient) Get(url string, args io.Reader) ([]byte, *http.Response, error)
- func (cli *CustomSpinClient) PipelineExecutionDetails(refID string, args io.Reader) (*PipelineExecutionDetailsResponse, *http.Response, error)
- func (cli *CustomSpinClient) Post(url string, args io.Reader) ([]byte, *http.Response, error)
- type DeletePipelineResponse
- type ExecutePipelineResponse
- type HTTPClient
- type MockApplicationControllerAPI
- type MockApplicationControllerAPIWithEmptyID
- type MockCustomSpinCli
- type MockPipelineControllerAPI
- func (p *MockPipelineControllerAPI) DeletePipelineUsingDELETE(ctx context.Context, application string, pipeline string) (*http.Response, error)
- func (p *MockPipelineControllerAPI) InvokePipelineConfigUsingPOST1(ctx context.Context, application string, pipelineNameOrID string, ...) (*http.Response, error)
- func (p *MockPipelineControllerAPI) SavePipelineUsingPOST(ctx context.Context, pipeline interface{}, ...) (*http.Response, error)
- type PipelineControllerAPI
- type PipelineExecutionDetailsResponse
- type SpinCLI
- type SpinClient
- func (s *SpinClient) DeletePipeline(pipelineJSON string) (*http.Response, error)
- func (s *SpinClient) DeletePipelines(application string, pipelineNames []string, ch chan DeletePipelineResponse, ...)
- func (s *SpinClient) ExecutePipeline(argsJSON string, stringify bool) (string, *http.Response, error)
- func (s *SpinClient) GetPipeline(application string, pipelineName string) (map[string]interface{}, *http.Response, error)
- func (s *SpinClient) GetPipelinesNamesAndApplication(pipelineJSON string) ([]string, string, error)
- func (s *SpinClient) RunTest(testName string, testConfig shore_testing.TestsConfig, ...) *TestPipelineResponse
- func (s *SpinClient) SavePipeline(pipelineJSON string) (*http.Response, error)
- func (s *SpinClient) TestPipeline(testConfig shore_testing.TestsConfig, onChange func(), stringify bool) error
- func (s *SpinClient) ValidateTestResponses(testResponse TestPipelineResponse, timeout int, testErrors map[string][]string) error
- func (s *SpinClient) WaitForPipelineToFinish(refID string, timeout int) (string, *http.Response, error)
- type TestPipelineResponse
- type UI
Constants ¶
const ( // PipelineNotStarted - Pipeline is in NOT_STARTED state PipelineNotStarted = "NOT_STARTED" // PipelineRunning - Pipeline is in RUNNING state PipelineRunning = "RUNNING" // PipelinePaused - Pipeline is in PAUSED state PipelinePaused = "PAUSED" // PipelineSuspended - Pipeline is in SUSPENDED state PipelineSuspended = "SUSPENDED" // PipelineSucceeded - Pipeline is in SUCCEEDED state PipelineSucceeded = "SUCCEEDED" // PipelineFailedContinue - Pipeline is in FAILED_CONTINUE state PipelineFailedContinue = "FAILED_CONTINUE" // PipelineTerminal - Pipeline is in TERMINAL state PipelineTerminal = "TERMINAL" // PipelineCanceled - Pipeline is in CANCELED state PipelineCanceled = "CANCELED" // PipelineRedirect - Pipeline is in REDIRECT state PipelineRedirect = "REDIRECT" // PipelineStopped - Pipeline is in STOPPED state PipelineStopped = "STOPPED" // PipelineSkipped - Pipeline is in SKIPPED state PipelineSkipped = "SKIPPED" // PipelineBuffered - Pipeline is in BUFFERED state PipelineBuffered = "BUFFERED" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ApplicationControllerAPI ¶
type ApplicationControllerAPI interface {
GetPipelineConfigUsingGET(ctx context.Context, application string, pipelineName string) (map[string]interface{}, *http.Response, error)
}
ApplicationControllerAPI - Interface wrapper for the Application Controller API
type ApplicationControllerError ¶
type ApplicationControllerError struct {
// contains filtered or unexported fields
}
func NewApplicationControllerError ¶
func NewApplicationControllerError(spinnakerErr error, response *http.Response) *ApplicationControllerError
NewApplicationControllerError returns an error which wraps an error and HTTP response from gateapi's ApplicationController. This provides a consistent interface for reading the response body, without having to deal with the quirky ways Spinnaker wraps errors and manages response body lifetimes.
func (ApplicationControllerError) Error ¶
func (e ApplicationControllerError) Error() string
func (ApplicationControllerError) StatusCode ¶
func (e ApplicationControllerError) StatusCode() int
type CustomCliError ¶
CustomCliError - an error wrapper for the Spinnaker API errors
func (*CustomCliError) Error ¶
func (e *CustomCliError) Error() string
type CustomSpinCLI ¶
type CustomSpinCLI interface { Do(req *http.Request) ([]byte, *http.Response, error) Post(url string, args io.Reader) ([]byte, *http.Response, error) Get(url string, args io.Reader) ([]byte, *http.Response, error) ExecutePipeline(application, pipelineName string, args io.Reader) (*ExecutePipelineResponse, *http.Response, error) PipelineExecutionDetails(refID string, args io.Reader) (*PipelineExecutionDetailsResponse, *http.Response, error) }
CustomSpinCLI is a wrapper the implementes specific requests that are either broken or unsupported by SpinCLI.
type CustomSpinClient ¶
type CustomSpinClient struct { CustomSpinCLI Endpoint string HTTPClient HTTPClient }
CustomSpinClient is a wrapper the implementes specific requests that are either broken or unsupported by SpinCLI.
func (*CustomSpinClient) ExecutePipeline ¶
func (cli *CustomSpinClient) ExecutePipeline(application, pipelineName string, args io.Reader) (*ExecutePipelineResponse, *http.Response, error)
ExecutePipeline calls the POST endpoint of a pipeline to execute it
func (*CustomSpinClient) PipelineExecutionDetails ¶
func (cli *CustomSpinClient) PipelineExecutionDetails(refID string, args io.Reader) (*PipelineExecutionDetailsResponse, *http.Response, error)
type DeletePipelineResponse ¶ added in v0.0.12
type ExecutePipelineResponse ¶
type ExecutePipelineResponse struct {
Ref string
}
ExecutePipelineResponse - Spinnaker Execution Response which contains the RefID to a Spinnaker Pipeline Execution.
type HTTPClient ¶
CustomSpinCLI is a wrapper the implementes specific requests that are either broken or unsupported by SpinCLI.
type MockApplicationControllerAPI ¶
type MockApplicationControllerAPI struct{}
type MockApplicationControllerAPIWithEmptyID ¶
type MockApplicationControllerAPIWithEmptyID struct{}
type MockCustomSpinCli ¶
type MockCustomSpinCli struct {
CustomSpinCLI
}
func (*MockCustomSpinCli) ExecutePipeline ¶
func (s *MockCustomSpinCli) ExecutePipeline(application, pipelineName string, args io.Reader) (*ExecutePipelineResponse, *http.Response, error)
func (*MockCustomSpinCli) PipelineExecutionDetails ¶
func (s *MockCustomSpinCli) PipelineExecutionDetails(refID string, args io.Reader) (*PipelineExecutionDetailsResponse, *http.Response, error)
type MockPipelineControllerAPI ¶
func (*MockPipelineControllerAPI) DeletePipelineUsingDELETE ¶ added in v0.0.12
func (*MockPipelineControllerAPI) InvokePipelineConfigUsingPOST1 ¶
func (p *MockPipelineControllerAPI) InvokePipelineConfigUsingPOST1(ctx context.Context, application string, pipelineNameOrID string, localVarOptionals *spinGateApi.PipelineControllerApiInvokePipelineConfigUsingPOST1Opts) (*http.Response, error)
func (*MockPipelineControllerAPI) SavePipelineUsingPOST ¶
func (p *MockPipelineControllerAPI) SavePipelineUsingPOST(ctx context.Context, pipeline interface{}, localVarOptionals *spinGateApi.PipelineControllerApiSavePipelineUsingPOSTOpts) (*http.Response, error)
type PipelineControllerAPI ¶
type PipelineControllerAPI interface { SavePipelineUsingPOST(ctx context.Context, pipeline interface{}, localVarOptionals *spinGateApi.PipelineControllerApiSavePipelineUsingPOSTOpts) (*http.Response, error) DeletePipelineUsingDELETE(ctx context.Context, application string, pipelineName string) (*http.Response, error) }
PipelineControllerAPI - Interface wrapper for the Pipeline Controller API
type PipelineExecutionDetailsResponse ¶
type PipelineExecutionDetailsResponse struct { Type string `json:"type"` Status string `json:"status"` Canceled bool `json:"canceled"` BuildTime int `json:"buildTime"` StartTime int `json:"startTime"` Application string `json:"application"` Stages []map[string]interface{} `json:"stages"` PipelineName string `json:"pipelineName"` }
type SpinCLI ¶
type SpinCLI struct { ApplicationControllerAPI PipelineControllerAPI context.Context }
SpinCLI is a wrapper for the spin-cli gateway client backed by swagger
type SpinClient ¶
type SpinClient struct { *SpinCLI CustomSpinCLI // contains filtered or unexported fields }
SpinClient - Concrete type requiring all the methods of the specified interfaces.
func NewClient ¶
func NewClient(logger logrus.FieldLogger) *SpinClient
NewClient - Create a new default spinnaker client
func (*SpinClient) DeletePipeline ¶ added in v0.0.12
func (s *SpinClient) DeletePipeline(pipelineJSON string) (*http.Response, error)
DeletePipeline - deletes rendered pipeline (recursively, if there are nested pipelines)
func (*SpinClient) DeletePipelines ¶ added in v0.0.12
func (s *SpinClient) DeletePipelines(application string, pipelineNames []string, ch chan DeletePipelineResponse, errCh chan error)
DeletePipelines - asynchronously deletes pipelines list from the application provided as input. Writes results to ch. Error encountered is written to errCh and waits till all running in parallel deletion goroutines finish.
func (*SpinClient) ExecutePipeline ¶
func (s *SpinClient) ExecutePipeline(argsJSON string, stringify bool) (string, *http.Response, error)
ExecutePipeline - Execute a spinnaker pipeline.
`patameters` are optional.
func (*SpinClient) GetPipeline ¶
func (*SpinClient) GetPipelinesNamesAndApplication ¶ added in v0.0.12
func (s *SpinClient) GetPipelinesNamesAndApplication(pipelineJSON string) ([]string, string, error)
GetPipelinesNamesAndApplication - gets list of names of all pipelines and application name configured
func (*SpinClient) RunTest ¶
func (s *SpinClient) RunTest(testName string, testConfig shore_testing.TestsConfig, testErrors map[string][]string, stringify bool) *TestPipelineResponse
func (*SpinClient) SavePipeline ¶
func (s *SpinClient) SavePipeline(pipelineJSON string) (*http.Response, error)
SavePipeline - Creates or Update nested pipelines recursively
func (*SpinClient) TestPipeline ¶
func (s *SpinClient) TestPipeline(testConfig shore_testing.TestsConfig, onChange func(), stringify bool) error
TestPipeline - Run a Spinnaker testing Currently returns a not-so-well formatted error. The intended solution is to create a shared API between `shore-cli` & the `backend` to expect well formatted struct for the CLI to render correctly. TODO: Design a struct to pass data back to `shore-cli` so the UI layer could render the test-results correctly.
func (*SpinClient) ValidateTestResponses ¶
func (s *SpinClient) ValidateTestResponses(testResponse TestPipelineResponse, timeout int, testErrors map[string][]string) error
func (*SpinClient) WaitForPipelineToFinish ¶
func (s *SpinClient) WaitForPipelineToFinish(refID string, timeout int) (string, *http.Response, error)
WaitForPipelineToFinish - Wait for the pipeline to finish running. This call uses sleeps and is a blocking call.
type TestPipelineResponse ¶
type TestPipelineResponse struct { ExecutionDetails *PipelineExecutionDetailsResponse // contains filtered or unexported fields }
type UI ¶
type UI struct{}
UI A fake UI
func (*UI) Ask ¶
Ask asks the user for input using the given query. The response is returned as the given string, or an error.
func (*UI) AskSecret ¶
AskSecret asks the user for input using the given query, but does not echo the keystrokes to the terminal.
func (*UI) Info ¶
Info is called for information related to the previous output. In general this may be the exact same as Output, but this gives Ui implementors some flexibility with output formats.
func (*UI) JsonOutput ¶
func (ui *UI) JsonOutput(data interface{})
JsonOutput is used to output data in JSON format (probably?) Seems like the spin cli maintainers didn't follow standards, the method name should have been `JSONOutput` according to Golang best practices