Documentation
¶
Overview ¶
package pipedsdk provides software development kits for building PipeCD piped plugins.
Index ¶
- func NewPluginCommand() *cobra.Command
- func RegisterDeploymentPlugin[Config, DeployTargetConfig any](plugin DeploymentPlugin[Config, DeployTargetConfig])
- func RegisterLivestatePlugin[Config, DeployTargetConfig any](plugin LivestatePlugin[Config, DeployTargetConfig])
- func RegisterStagePlugin[Config, DeployTargetConfig any](plugin StagePlugin[Config, DeployTargetConfig])
- func Run() error
- type ApplicationHealthStatus
- type ApplicationLiveState
- type ApplicationSyncState
- type ApplicationSyncStatus
- type ArtifactKind
- type ArtifactVersion
- type BuildPipelineSyncStagesInput
- type BuildPipelineSyncStagesRequest
- type BuildPipelineSyncStagesResponse
- type BuildQuickSyncStagesInput
- type BuildQuickSyncStagesRequest
- type BuildQuickSyncStagesResponse
- type Client
- func (c *Client) GetDeploymentPluginMetadata(ctx context.Context, key string) (string, error)
- func (c *Client) GetDeploymentSharedMetadata(ctx context.Context, key string) (string, error)
- func (c *Client) GetStageMetadata(ctx context.Context, key string) (string, error)
- func (c Client) ListStageCommands(ctx context.Context, commandTypes ...model.Command_Type) iter.Seq2[*StageCommand, error]
- func (c *Client) LogPersister() StageLogPersister
- func (c *Client) PutDeploymentPluginMetadata(ctx context.Context, key, value string) error
- func (c *Client) PutDeploymentPluginMetadataMulti(ctx context.Context, metadata map[string]string) error
- func (c *Client) PutStageMetadata(ctx context.Context, key, value string) error
- func (c *Client) PutStageMetadataMulti(ctx context.Context, metadata map[string]string) error
- func (c *Client) ToolRegistry() *toolregistry.ToolRegistry
- type CommandType
- type ConfigNone
- type DeployTarget
- type DeployTargetsNone
- type Deployment
- type DeploymentPlugin
- type DeploymentPluginServiceServer
- func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) BuildPipelineSyncStages(ctx context.Context, request *deployment.BuildPipelineSyncStagesRequest) (*deployment.BuildPipelineSyncStagesResponse, error)
- func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) BuildQuickSyncStages(ctx context.Context, request *deployment.BuildQuickSyncStagesRequest) (*deployment.BuildQuickSyncStagesResponse, error)
- func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) DetermineStrategy(ctx context.Context, request *deployment.DetermineStrategyRequest) (*deployment.DetermineStrategyResponse, error)
- func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) DetermineVersions(ctx context.Context, request *deployment.DetermineVersionsRequest) (*deployment.DetermineVersionsResponse, error)
- func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) ExecuteStage(ctx context.Context, request *deployment.ExecuteStageRequest) (response *deployment.ExecuteStageResponse, _ error)
- func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) FetchDefinedStages(context.Context, *deployment.FetchDefinedStagesRequest) (*deployment.FetchDefinedStagesResponse, error)
- func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) Name() string
- func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) Register(server *grpc.Server)
- func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) Version() string
- type DeploymentSource
- type DetermineStrategyInput
- type DetermineStrategyRequest
- type DetermineStrategyResponse
- type DetermineVersionsInput
- type DetermineVersionsRequest
- type DetermineVersionsResponse
- type ExecuteStageInput
- type ExecuteStageRequest
- type ExecuteStageResponse
- type GetLivestateInput
- type GetLivestateRequest
- type GetLivestateResponse
- type LivestatePlugin
- type LivestatePluginServer
- func (s *LivestatePluginServer[Config, DeployTargetConfig]) GetLivestate(ctx context.Context, request *livestate.GetLivestateRequest) (*livestate.GetLivestateResponse, error)
- func (s *LivestatePluginServer[Config, DeployTargetConfig]) Name() string
- func (s *LivestatePluginServer[Config, DeployTargetConfig]) Register(server *grpc.Server)
- func (s *LivestatePluginServer[Config, DeployTargetConfig]) Version() string
- type ManualOperation
- type PipelineStage
- type Plugin
- type QuickSyncStage
- type ResourceHealthStatus
- type ResourceState
- type StageCommand
- type StageConfig
- type StageLogPersister
- type StagePlugin
- type StagePluginServiceServer
- func (s *StagePluginServiceServer[Config, DeployTargetConfig]) BuildPipelineSyncStages(ctx context.Context, request *deployment.BuildPipelineSyncStagesRequest) (*deployment.BuildPipelineSyncStagesResponse, error)
- func (s *StagePluginServiceServer[Config, DeployTargetConfig]) BuildQuickSyncStages(context.Context, *deployment.BuildQuickSyncStagesRequest) (*deployment.BuildQuickSyncStagesResponse, error)
- func (s *StagePluginServiceServer[Config, DeployTargetConfig]) DetermineStrategy(context.Context, *deployment.DetermineStrategyRequest) (*deployment.DetermineStrategyResponse, error)
- func (s *StagePluginServiceServer[Config, DeployTargetConfig]) DetermineVersions(context.Context, *deployment.DetermineVersionsRequest) (*deployment.DetermineVersionsResponse, error)
- func (s *StagePluginServiceServer[Config, DeployTargetConfig]) ExecuteStage(ctx context.Context, request *deployment.ExecuteStageRequest) (response *deployment.ExecuteStageResponse, _ error)
- func (s *StagePluginServiceServer[Config, DeployTargetConfig]) FetchDefinedStages(context.Context, *deployment.FetchDefinedStagesRequest) (*deployment.FetchDefinedStagesResponse, error)
- func (s *StagePluginServiceServer[Config, DeployTargetConfig]) Name() string
- func (s *StagePluginServiceServer[Config, DeployTargetConfig]) Register(server *grpc.Server)
- func (s *StagePluginServiceServer[Config, DeployTargetConfig]) Version() string
- type StageStatus
- type SyncStrategy
- type TODO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPluginCommand ¶
NewPluginCommand creates a new cobra command for executing api server.
func RegisterDeploymentPlugin ¶
func RegisterDeploymentPlugin[Config, DeployTargetConfig any](plugin DeploymentPlugin[Config, DeployTargetConfig])
RegisterDeploymentPlugin registers the given deployment plugin. It will be used when running the piped.
func RegisterLivestatePlugin ¶
func RegisterLivestatePlugin[Config, DeployTargetConfig any](plugin LivestatePlugin[Config, DeployTargetConfig])
RegisterLivestatePlugin registers the given LivestatePlugin to the sdk.
func RegisterStagePlugin ¶
func RegisterStagePlugin[Config, DeployTargetConfig any](plugin StagePlugin[Config, DeployTargetConfig])
RegisterStagePlugin registers the given stage plugin. It will be used when running the piped.
Types ¶
type ApplicationHealthStatus ¶
type ApplicationHealthStatus int
ApplicationHealthStatus represents the health status of an application.
const ( // ApplicationHealthStateUnknown represents the unknown health status of an application. ApplicationHealthStateUnknown ApplicationHealthStatus = iota // ApplicationHealthStateHealthy represents the healthy health status of an application. ApplicationHealthStateHealthy // ApplicationHealthStateOther represents the other health status of an application. ApplicationHealthStateOther )
type ApplicationLiveState ¶
type ApplicationLiveState struct { Resources []ResourceState HealthStatus ApplicationHealthStatus }
ApplicationLiveState represents the live state of an application.
type ApplicationSyncState ¶
type ApplicationSyncState struct { // Status is the sync status of the application. Status ApplicationSyncStatus // ShortReason is the short reason of the sync status. // for example, "The service manifest doesn't be synced" ShortReason string // Reason is the reason of the sync status. // actually, it's the difference between the desired state and the live state. Reason string }
ApplicationSyncState represents the sync state of an application.
type ApplicationSyncStatus ¶
type ApplicationSyncStatus int
ApplicationSyncStatus represents the sync status of an application.
const ( // ApplicationSyncStateUnknown represents the unknown sync status of an application. ApplicationSyncStateUnknown ApplicationSyncStatus = iota // ApplicationSyncStateSynced represents the synced sync status of an application. ApplicationSyncStateSynced // ApplicationSyncStateOutOfSync represents the out-of-sync sync status of an application. ApplicationSyncStateOutOfSync // ApplicationSyncStateInvalidConfig represents the invalid-config sync status of an application. ApplicationSyncStateInvalidConfig )
type ArtifactKind ¶
type ArtifactKind int
ArtifactKind represents the kind of the artifact.
const ( // ArtifactKindUnknown indicates that the kind of the artifact is unknown. ArtifactKindUnknown ArtifactKind = iota // ArtifactKindContainerImage indicates that the artifact is a container image. ArtifactKindContainerImage // ArtifactKindS3Object indicates that the artifact is an S3 object. ArtifactKindS3Object // ArtifactKindGitSource indicates that the artifact is a git source. ArtifactKindGitSource // ArtifactKindTerraformModule indicates that the artifact is a terraform module. ArtifactKindTerraformModule )
type ArtifactVersion ¶
type ArtifactVersion struct { // Kind is the kind of the artifact. Kind ArtifactKind // Version is the version of the artifact. Version string // Name is the name of the artifact. Name string // URL is the URL of the artifact. URL string }
ArtifactVersion represents the version of an artifact.
type BuildPipelineSyncStagesInput ¶
type BuildPipelineSyncStagesInput struct { // Request is the request to build pipeline sync stages. Request BuildPipelineSyncStagesRequest // Client is the client to interact with the piped. Client *Client // Logger is the logger to log the events. Logger *zap.Logger }
BuildPipelineSyncStagesInput is the input for the BuildPipelineSyncStages method.
type BuildPipelineSyncStagesRequest ¶
type BuildPipelineSyncStagesRequest struct { // Rollback indicates whether the stages for rollback are requested. Rollback bool // Stages contains the stage names and their configurations. Stages []StageConfig }
BuildPipelineSyncStagesRequest is the request to build pipeline sync stages. Rollback indicates whether the stages for rollback are requested.
type BuildPipelineSyncStagesResponse ¶
type BuildPipelineSyncStagesResponse struct {
Stages []PipelineStage
}
BuildPipelineSyncStagesResponse is the response of the request to build pipeline sync stages.
type BuildQuickSyncStagesInput ¶
type BuildQuickSyncStagesInput struct { // Request is the request to build pipeline sync stages. Request BuildQuickSyncStagesRequest // Client is the client to interact with the piped. Client *Client // Logger is the logger to log the events. Logger *zap.Logger }
BuildQuickSyncStagesInput is the input for the BuildQuickSyncStages method.
type BuildQuickSyncStagesRequest ¶
type BuildQuickSyncStagesRequest struct { // Rollback indicates whether the stages for rollback are requested. Rollback bool }
BuildQuickSyncStagesRequest is the request to build quick sync stages. Rollback indicates whether the stages for rollback are requested.
type BuildQuickSyncStagesResponse ¶
type BuildQuickSyncStagesResponse struct {
Stages []QuickSyncStage
}
BuildQuickSyncStagesResponse is the response of the request to build quick sync stages.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a toolkit for interacting with the piped service. It provides methods to call the piped service APIs. It's a wrapper around the raw piped service client.
func NewClient ¶
func NewClient(base *pipedapi.PluginServiceClient, pluginName, applicationID, stageID string, lp StageLogPersister, tr *toolregistry.ToolRegistry) *Client
NewClient creates a new client. DO NOT USE this function except in tests. FIXME: Remove this function and make a better way for tests.
func (*Client) GetDeploymentPluginMetadata ¶
GetDeploymentPluginMetadata gets the metadata of the current deployment and plugin.
func (*Client) GetDeploymentSharedMetadata ¶
GetDeploymentSharedMetadata gets the metadata of the current deployment which is shared among piped and plugins.
func (*Client) GetStageMetadata ¶
GetStageMetadata gets the metadata of the current stage.
func (Client) ListStageCommands ¶
func (c Client) ListStageCommands(ctx context.Context, commandTypes ...model.Command_Type) iter.Seq2[*StageCommand, error]
ListStageCommands returns the list of stage commands of the given command types.
func (*Client) LogPersister ¶
func (c *Client) LogPersister() StageLogPersister
LogPersister returns the stage log persister. Use this to persist the stage logs and make it viewable on the UI. This method should be called only when the client is working with a specific stage, for example, when this client is passed as the ExecuteStage method's argument. Otherwise, it will return nil. TODO: we should consider returning an error instead of nil, or return logger which prints to stdout.
func (*Client) PutDeploymentPluginMetadata ¶
PutDeploymentPluginMetadata stores the metadata of the current deployment and plugin.
func (*Client) PutDeploymentPluginMetadataMulti ¶
func (c *Client) PutDeploymentPluginMetadataMulti(ctx context.Context, metadata map[string]string) error
PutDeploymentPluginMetadataMulti stores the multiple metadata of the current deployment and plugin.
func (*Client) PutStageMetadata ¶
PutStageMetadata stores the metadata of the current stage.
func (*Client) PutStageMetadataMulti ¶
PutStageMetadataMulti stores the multiple metadata of the current stage.
func (*Client) ToolRegistry ¶
func (c *Client) ToolRegistry() *toolregistry.ToolRegistry
ToolRegistry returns the tool registry. Use this to install and get the path of the tools used in the plugin.
type CommandType ¶
type CommandType int32
CommandType represents the type of the command.
const ( CommandTypeApproveStage CommandType = iota CommandTypeSkipStage )
type ConfigNone ¶
type ConfigNone = *struct{}
ConfigNone is a type alias for a pointer to a struct with an empty struct as the generic type parameter. This utility is defined for plugins which has no config handling in ExecuteStage.
type DeployTarget ¶
type DeployTarget[Config any] struct { // The name of the deploy target. Name string `json:"name"` // The labes of the deploy target. Labels map[string]string `json:"labels,omitempty"` // The configuration of the deploy target. Config Config `json:"config"` }
DeployTarget defines the deploy target configuration for the piped.
type DeployTargetsNone ¶
type DeployTargetsNone = []*DeployTarget[struct{}]
DeployTargetsNone is a type alias for a slice of pointers to DeployTarget with an empty struct as the generic type parameter. It represents a case where there are no deployment targets. This utility is defined for plugins which has no deploy targets handling in ExecuteStage.
type Deployment ¶
type Deployment struct { // ID is the unique identifier of the deployment. ID string // ApplicationID is the unique identifier of the application. ApplicationID string // ApplicationName is the name of the application. ApplicationName string // PipedID is the unique identifier of the piped that is running the deployment. PipedID string // ProjectID is the unique identifier of the project that the application belongs to. ProjectID string // TriggeredBy is the name of the entity that triggered the deployment. TriggeredBy string // CreatedAt is the time when the deployment was created. CreatedAt int64 }
Deployment represents the deployment that the stage is running. This is read-only.
type DeploymentPlugin ¶
type DeploymentPlugin[Config, DeployTargetConfig any] interface { StagePlugin[Config, DeployTargetConfig] // DetermineVersions determines the versions of the resources that will be deployed. DetermineVersions(context.Context, *Config, *DetermineVersionsInput) (*DetermineVersionsResponse, error) // DetermineStrategy determines the strategy to deploy the resources. DetermineStrategy(context.Context, *Config, *DetermineStrategyInput) (*DetermineStrategyResponse, error) // BuildQuickSyncStages builds the stages that will be executed during the quick sync process. BuildQuickSyncStages(context.Context, *Config, *BuildQuickSyncStagesInput) (*BuildQuickSyncStagesResponse, error) }
DeploymentPlugin is the interface that be implemented by a full-spec deployment plugin. This kind of plugin should implement all methods to manage resources and execute stages. The Config and DeployTargetConfig are the plugin's config defined in piped's config.
type DeploymentPluginServiceServer ¶
type DeploymentPluginServiceServer[Config, DeployTargetConfig any] struct { deployment.UnimplementedDeploymentServiceServer // contains filtered or unexported fields }
DeploymentPluginServiceServer is the gRPC server that handles requests from the piped.
func (*DeploymentPluginServiceServer[Config, DeployTargetConfig]) BuildPipelineSyncStages ¶
func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) BuildPipelineSyncStages(ctx context.Context, request *deployment.BuildPipelineSyncStagesRequest) (*deployment.BuildPipelineSyncStagesResponse, error)
func (*DeploymentPluginServiceServer[Config, DeployTargetConfig]) BuildQuickSyncStages ¶
func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) BuildQuickSyncStages(ctx context.Context, request *deployment.BuildQuickSyncStagesRequest) (*deployment.BuildQuickSyncStagesResponse, error)
func (*DeploymentPluginServiceServer[Config, DeployTargetConfig]) DetermineStrategy ¶
func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) DetermineStrategy(ctx context.Context, request *deployment.DetermineStrategyRequest) (*deployment.DetermineStrategyResponse, error)
func (*DeploymentPluginServiceServer[Config, DeployTargetConfig]) DetermineVersions ¶
func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) DetermineVersions(ctx context.Context, request *deployment.DetermineVersionsRequest) (*deployment.DetermineVersionsResponse, error)
func (*DeploymentPluginServiceServer[Config, DeployTargetConfig]) ExecuteStage ¶
func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) ExecuteStage(ctx context.Context, request *deployment.ExecuteStageRequest) (response *deployment.ExecuteStageResponse, _ error)
func (*DeploymentPluginServiceServer[Config, DeployTargetConfig]) FetchDefinedStages ¶
func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) FetchDefinedStages(context.Context, *deployment.FetchDefinedStagesRequest) (*deployment.FetchDefinedStagesResponse, error)
func (*DeploymentPluginServiceServer[Config, DeployTargetConfig]) Name ¶
func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) Name() string
Name returns the name of the plugin.
func (*DeploymentPluginServiceServer[Config, DeployTargetConfig]) Register ¶
func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) Register(server *grpc.Server)
Register registers the server to the given gRPC server.
func (*DeploymentPluginServiceServer[Config, DeployTargetConfig]) Version ¶
func (s *DeploymentPluginServiceServer[Config, DeployTargetConfig]) Version() string
type DeploymentSource ¶
type DeploymentSource struct { // ApplicationDirectory is the directory where the source code is located. ApplicationDirectory string // CommitHash is the git commit hash of the source code. CommitHash string // ApplicationConfig is the configuration of the application. ApplicationConfig []byte // ApplicationConfigFilename is the name of the file that contains the application configuration. // The plugins can use this to avoid mistakenly reading this file as a manifest to deploy. ApplicationConfigFilename string }
DeploymentSource represents the source of the deployment.
type DetermineStrategyInput ¶
type DetermineStrategyInput struct { // Request is the request to determine the strategy. Request DetermineStrategyRequest // Client is the client to interact with the piped. Client *Client // Logger is the logger to log the events. Logger *zap.Logger }
DetermineStrategyInput is the input for the DetermineStrategy method.
type DetermineStrategyRequest ¶
type DetermineStrategyRequest struct { // Deployment is the deployment that the strategy will be determined. Deployment Deployment // RunningDeploymentSource is the source of the running deployment. RunningDeploymentSource DeploymentSource // TargetDeploymentSource is the source of the target deployment. TargetDeploymentSource DeploymentSource }
DetermineStrategyRequest is the request to determine the strategy.
type DetermineStrategyResponse ¶
type DetermineStrategyResponse struct { // Strategy is the strategy to deploy the resources. Strategy SyncStrategy // Summary is the summary of the strategy. Summary string }
DetermineStrategyResponse is the response of the request to determine the strategy.
type DetermineVersionsInput ¶
type DetermineVersionsInput struct { // Request is the request to determine versions. Request DetermineVersionsRequest // Client is the client to interact with the piped. Client *Client // Logger is the logger to log the events. Logger *zap.Logger }
DetermineVersionsInput is the input for the DetermineVersions method.
type DetermineVersionsRequest ¶
type DetermineVersionsRequest struct { // Deloyment is the deployment that the versions will be determined. Deployment Deployment // DeploymentSource is the source of the deployment. DeploymentSource DeploymentSource }
DetermineVersionsRequest is the request to determine versions.
type DetermineVersionsResponse ¶
type DetermineVersionsResponse struct { // Versions contains the versions of the resources. Versions []ArtifactVersion }
DetermineVersionsResponse is the response of the request to determine versions.
type ExecuteStageInput ¶
type ExecuteStageInput struct { // Request is the request to execute a stage. Request ExecuteStageRequest // Client is the client to interact with the piped. Client *Client // Logger is the logger to log the events. Logger *zap.Logger }
ExecuteStageInput is the input for the ExecuteStage method.
type ExecuteStageRequest ¶
type ExecuteStageRequest struct { // The name of the stage to execute. StageName string // Json encoded configuration of the stage. StageConfig []byte // RunningDeploymentSource is the source of the running deployment. RunningDeploymentSource DeploymentSource // TargetDeploymentSource is the source of the target deployment. TargetDeploymentSource DeploymentSource // The deployment that the stage is running. Deployment Deployment }
ExecuteStageRequest is the request to execute a stage.
type ExecuteStageResponse ¶
type ExecuteStageResponse struct {
Status StageStatus
}
ExecuteStageResponse is the response of the request to execute a stage.
type GetLivestateInput ¶
type GetLivestateInput struct { // Request is the request for getting the live state. Request GetLivestateRequest // Client is the client for accessing the piped API. Client *Client // Logger is the logger for logging. Logger *zap.Logger }
GetLivestateInput is the input for the GetLivestate method.
type GetLivestateRequest ¶
type GetLivestateRequest struct { // PipedID is the ID of the piped. PipedID string // ApplicationID is the ID of the application. ApplicationID string // ApplicationName is the name of the application. ApplicationName string // DeploymentSource is the source of the deployment. DeploymentSource DeploymentSource }
GetLivestateRequest is the request for the GetLivestate method.
type GetLivestateResponse ¶
type GetLivestateResponse struct { // LiveState is the live state of the application. LiveState ApplicationLiveState // SyncState is the sync state of the application. SyncState ApplicationSyncState }
GetLivestateResponse is the response for the GetLivestate method.
type LivestatePlugin ¶
type LivestatePlugin[Config, DeployTargetConfig any] interface { Plugin // GetLivestate returns the live state of the resources in the given application. // It returns the resources' live state and the difference between the desired state and the live state. // It's allowed to return only the resources' live state if the difference is not available, or only the difference if the live state is not available. GetLivestate(context.Context, *Config, []*DeployTarget[DeployTargetConfig], *GetLivestateInput) (*GetLivestateResponse, error) }
LivestatePlugin is the interface that must be implemented by a Livestate plugin. In addition to the Plugin interface, it provides a method to get the live state of the resources. The Config and DeployTargetConfig are the plugin's config defined in piped's config.
type LivestatePluginServer ¶
type LivestatePluginServer[Config, DeployTargetConfig any] struct { livestate.UnimplementedLivestateServiceServer // contains filtered or unexported fields }
LivestatePluginServer is a wrapper for LivestatePlugin to satisfy the LivestateServiceServer interface. It is used to register the plugin to the gRPC server.
func (*LivestatePluginServer[Config, DeployTargetConfig]) GetLivestate ¶
func (s *LivestatePluginServer[Config, DeployTargetConfig]) GetLivestate(ctx context.Context, request *livestate.GetLivestateRequest) (*livestate.GetLivestateResponse, error)
GetLivestate returns the live state of the resources in the given application.
func (*LivestatePluginServer[Config, DeployTargetConfig]) Name ¶
func (s *LivestatePluginServer[Config, DeployTargetConfig]) Name() string
Name returns the name of the plugin.
func (*LivestatePluginServer[Config, DeployTargetConfig]) Register ¶
func (s *LivestatePluginServer[Config, DeployTargetConfig]) Register(server *grpc.Server)
Register registers the plugin to the gRPC server.
func (*LivestatePluginServer[Config, DeployTargetConfig]) Version ¶
func (s *LivestatePluginServer[Config, DeployTargetConfig]) Version() string
Version returns the version of the plugin.
type ManualOperation ¶
type ManualOperation int
ManualOperation represents the manual operation that the user can perform.
const ( // ManualOperationNone indicates that there is no manual operation. ManualOperationNone ManualOperation = iota // ManualOperationSkip indicates that the manual operation is to skip the stage. ManualOperationSkip // ManualOperationApprove indicates that the manual operation is to approve the stage. ManualOperationApprove )
type PipelineStage ¶
type PipelineStage struct { // Index is the order of the stage in the pipeline. // The value must be one of the index of the stage in the request. // The rollback stage should have the same index as the original stage. Index int // Name is the name of the stage. // It must be one of the stages returned by FetchDefinedStages. Name string // Rollback indicates whether the stage is for rollback. Rollback bool // Metadata contains the metadata of the stage. Metadata map[string]string // AvailableOperation indicates the manual operation that the user can perform. AvailableOperation ManualOperation }
PipelineStage represents a stage in the pipeline.
type Plugin ¶
type Plugin interface { // Name returns the name of the plugin. Name() string // Version returns the version of the plugin. Version() string }
Plugin is the interface that must be implemented by a piped plugin.
type QuickSyncStage ¶
type QuickSyncStage struct { // Name is the name of the stage. // It must be one of the stages returned by FetchDefinedStages. Name string // Description is the description of the stage. Description string // Rollback indicates whether the stage is for rollback. Rollback bool // Metadata contains the metadata of the stage. Metadata map[string]string // AvailableOperation indicates the manual operation that the user can perform. AvailableOperation ManualOperation }
QuickSyncStage represents a stage in the pipeline.
type ResourceHealthStatus ¶
type ResourceHealthStatus int
ResourceHealthStatus represents the health status of a resource.
const ( // ResourceHealthStateUnknown represents the unknown health status of a resource. ResourceHealthStateUnknown ResourceHealthStatus = iota // ResourceHealthStateHealthy represents the healthy health status of a resource. ResourceHealthStateHealthy // ResourceHealthStateUnhealthy represents the unhealthy health status of a resource. ResourceHealthStateUnhealthy )
type ResourceState ¶
type ResourceState struct { // ID is the unique identifier of the resource. ID string // ParentIDs is the list of the parent resource's IDs. ParentIDs []string // Name is the name of the resource. Name string // ResourceType is the type of the resource. ResourceType string // ResourceMetadata is the metadata of the resource. ResourceMetadata map[string]string // HealthStatus is the health status of the resource. HealthStatus ResourceHealthStatus // HealthDescription is the description of the health status. HealthDescription string // DeployTarget is the target where the resource is deployed. DeployTarget string // CreatedAt is the time when the resource was created. CreatedAt time.Time }
ResourceState represents the live state of a resource.
type StageCommand ¶
type StageCommand struct { Commander string Type CommandType }
StageCommand represents a command for a stage.
type StageConfig ¶
type StageConfig struct { // Index is the order of the stage in the pipeline. Index int // Name is the name of the stage. // It must be one of the stages returned by FetchDefinedStages. Name string // Config is the configuration of the stage. // It should be marshaled to JSON bytes. // The plugin should unmarshal it to the appropriate struct. Config []byte }
StageConfig represents the configuration of a stage.
type StageLogPersister ¶
type StageLogPersister interface { Write(log []byte) (int, error) Info(log string) Infof(format string, a ...interface{}) Success(log string) Successf(format string, a ...interface{}) Error(log string) Errorf(format string, a ...interface{}) }
StageLogPersister is a interface for persisting the stage logs. Use this to persist the stage logs and make it viewable on the UI.
type StagePlugin ¶
type StagePlugin[Config, DeployTargetConfig any] interface { Plugin // FetchDefinedStages returns the list of stages that the plugin can execute. FetchDefinedStages() []string // BuildPipelineSyncStages builds the stages that will be executed by the plugin. BuildPipelineSyncStages(context.Context, *Config, *BuildPipelineSyncStagesInput) (*BuildPipelineSyncStagesResponse, error) // ExecuteStage executes the given stage. ExecuteStage(context.Context, *Config, []*DeployTarget[DeployTargetConfig], *ExecuteStageInput) (*ExecuteStageResponse, error) }
StagePlugin is the interface implemented by a plugin that focuses on executing generic stages. This kind of plugin may not implement quick sync stages. The Config and DeployTargetConfig are the plugin's config defined in piped's config.
type StagePluginServiceServer ¶
type StagePluginServiceServer[Config, DeployTargetConfig any] struct { deployment.UnimplementedDeploymentServiceServer // contains filtered or unexported fields }
StagePluginServiceServer is the gRPC server that handles requests from the piped.
func (*StagePluginServiceServer[Config, DeployTargetConfig]) BuildPipelineSyncStages ¶
func (s *StagePluginServiceServer[Config, DeployTargetConfig]) BuildPipelineSyncStages(ctx context.Context, request *deployment.BuildPipelineSyncStagesRequest) (*deployment.BuildPipelineSyncStagesResponse, error)
func (*StagePluginServiceServer[Config, DeployTargetConfig]) BuildQuickSyncStages ¶
func (s *StagePluginServiceServer[Config, DeployTargetConfig]) BuildQuickSyncStages(context.Context, *deployment.BuildQuickSyncStagesRequest) (*deployment.BuildQuickSyncStagesResponse, error)
func (*StagePluginServiceServer[Config, DeployTargetConfig]) DetermineStrategy ¶
func (s *StagePluginServiceServer[Config, DeployTargetConfig]) DetermineStrategy(context.Context, *deployment.DetermineStrategyRequest) (*deployment.DetermineStrategyResponse, error)
func (*StagePluginServiceServer[Config, DeployTargetConfig]) DetermineVersions ¶
func (s *StagePluginServiceServer[Config, DeployTargetConfig]) DetermineVersions(context.Context, *deployment.DetermineVersionsRequest) (*deployment.DetermineVersionsResponse, error)
func (*StagePluginServiceServer[Config, DeployTargetConfig]) ExecuteStage ¶
func (s *StagePluginServiceServer[Config, DeployTargetConfig]) ExecuteStage(ctx context.Context, request *deployment.ExecuteStageRequest) (response *deployment.ExecuteStageResponse, _ error)
func (*StagePluginServiceServer[Config, DeployTargetConfig]) FetchDefinedStages ¶
func (s *StagePluginServiceServer[Config, DeployTargetConfig]) FetchDefinedStages(context.Context, *deployment.FetchDefinedStagesRequest) (*deployment.FetchDefinedStagesResponse, error)
func (*StagePluginServiceServer[Config, DeployTargetConfig]) Name ¶
func (s *StagePluginServiceServer[Config, DeployTargetConfig]) Name() string
Name returns the name of the plugin.
func (*StagePluginServiceServer[Config, DeployTargetConfig]) Register ¶
func (s *StagePluginServiceServer[Config, DeployTargetConfig]) Register(server *grpc.Server)
Register registers the server to the given gRPC server.
func (*StagePluginServiceServer[Config, DeployTargetConfig]) Version ¶
func (s *StagePluginServiceServer[Config, DeployTargetConfig]) Version() string
Version returns the version of the plugin.
type StageStatus ¶
type StageStatus int
StageStatus represents the current status of a stage of a deployment.
const ( // StageStatusSuccess indicates that the stage succeeded. StageStatusSuccess StageStatus // StageStatusFailure indicates that the stage failed. StageStatusFailure // StageStatusExited can be used when the stage succeeded and exit the pipeline without executing the following stages. StageStatusExited )
type SyncStrategy ¶
type SyncStrategy int
SyncStrategy represents the strategy to deploy the resources.
const ( // SyncStrategyQuickSync indicates that the resources will be deployed using the quick sync strategy. SyncStrategyQuickSync SyncStrategy // SyncStrategyPipelineSync indicates that the resources will be deployed using the pipeline sync strategy. SyncStrategyPipelineSync )