Documentation
¶
Index ¶
- Variables
- type CleanupStageData
- type DeployStageData
- type DeploymentState
- type DestroyStageData
- type Docker
- type InitStageData
- type JobTrigger
- type MetaData
- type PostDeployStageData
- type PostDestroyStageData
- type PreDeployStageData
- type RepositoryData
- type StageFunc
- type StageManager
- func (s *StageManager) GetDeployStageOrder() StageOrder
- func (s *StageManager) GetDestroyStageOrder() StageOrder
- func (s *StageManager) GetStageMetaData(stageName StageName) (*MetaData, error)
- func (s *StageManager) NotifyFailure(notifyErr error)
- func (s *StageManager) RunCleanupStage(_ context.Context, _ *slog.Logger) error
- func (s *StageManager) RunDeployStage(ctx context.Context, stageLog *slog.Logger) error
- func (s *StageManager) RunDestroyStage(ctx context.Context, stageLog *slog.Logger) error
- func (s *StageManager) RunInitStage(ctx context.Context, stageLog *slog.Logger) error
- func (s *StageManager) RunPostDeployStage(_ context.Context, stageLog *slog.Logger) error
- func (s *StageManager) RunPostDestroyStage(_ context.Context, stageLog *slog.Logger) error
- func (s *StageManager) RunPreDeployStage(ctx context.Context, stageLog *slog.Logger) error
- func (s *StageManager) RunStages(ctx context.Context) error
- type StageName
- type StageOrder
- type StageResult
- type StageStatus
- type Stages
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotManagedByDocoCD = errors.New("stack is not managed by doco-cd") ErrDeploymentConflict = errors.New("another stack with the same name already exists and is not managed by this repository") ErrSkipDeployment = errors.New("deployment skipped") // Special error to indicate deployment was skipped, not an actual failure/error )
Functions ¶
This section is empty.
Types ¶
type CleanupStageData ¶
type CleanupStageData struct {
MetaData
}
CleanupStageData holds the configuration and data specific to the cleanup stage.
type DeployStageData ¶
type DeployStageData struct {
MetaData
}
DeployStageData holds the configuration and data specific to the deployment stage.
type DeploymentState ¶
type DeploymentState struct {
ChangedFiles []gitInternal.ChangedFile
SecretsChanged bool
ResolvedSecrets secrettypes.ResolvedSecrets
}
DeploymentState holds the dynamic state information during the deployment process.
type DestroyStageData ¶
type DestroyStageData struct {
MetaData
}
type InitStageData ¶
type InitStageData struct {
MetaData
}
InitStageData holds the configuration and data specific to the initialization stage.
type JobTrigger ¶
type JobTrigger string
const ( JobTriggerWebhook JobTrigger = "webhook" JobTriggerPoll JobTrigger = "poll" )
type MetaData ¶
func NewMetaData ¶
type PostDeployStageData ¶
type PostDeployStageData struct {
MetaData
}
PostDeployStageData holds the configuration and data specific to the post-deployment stage.
type PostDestroyStageData ¶
type PostDestroyStageData struct {
MetaData
}
type PreDeployStageData ¶
type PreDeployStageData struct {
MetaData
}
PreDeployStageData holds the configuration and data specific to the pre-deployment stage.
type RepositoryData ¶
type RepositoryData struct {
CloneURL config.HttpUrl // Repository clone URL (e.g., "https://github.com/user/my-repo.git")
Name string // Repository name (e.g., "user/my-repo")
PathInternal string // Path to the repository inside the container
PathExternal string // Path to the repository on the host machine
Git *git.Repository // Git repository instance
}
RepositoryData holds information about the triggering repository.
type StageManager ¶
type StageManager struct {
Stages *Stages
Log *slog.Logger
JobID string // Unique identifier for the job
JobTrigger JobTrigger // Trigger type for the job (e.g., "webhook", "poll")
NotifyFailureFunc func(err error, metadata notification.Metadata) // Function to call on failure
AppConfig *config.AppConfig
DeployConfig *config.DeployConfig
DeployState *DeploymentState
Docker *Docker
Payload *webhook.ParsedPayload
Repository *RepositoryData
SecretProvider *secretprovider.SecretProvider
}
StageManager is the main structure that holds the logger and stage data.
func NewStageManager ¶
func NewStageManager(jobID string, jobTrigger JobTrigger, log *slog.Logger, failNotifyFunc func(err error, metadata notification.Metadata), repoData *RepositoryData, dockerData *Docker, payload *webhook.ParsedPayload, appConfig *config.AppConfig, deployConfig *config.DeployConfig, secretProvider *secretprovider.SecretProvider, ) *StageManager
NewStageManager creates and initializes a new StageManager instance for managing stages.ß.
func (*StageManager) GetDeployStageOrder ¶
func (s *StageManager) GetDeployStageOrder() StageOrder
GetDeployStageOrder returns the order of stages for the deployment process.
func (*StageManager) GetDestroyStageOrder ¶
func (s *StageManager) GetDestroyStageOrder() StageOrder
GetDestroyStageOrder returns the order of stages for the destroy process.
func (*StageManager) GetStageMetaData ¶
func (s *StageManager) GetStageMetaData(stageName StageName) (*MetaData, error)
GetStageMetaData retrieves the metadata for the specified stage.
func (*StageManager) NotifyFailure ¶
func (s *StageManager) NotifyFailure(notifyErr error)
NotifyFailure sends a failure notification using the provided NotifyFailureFunc.
func (*StageManager) RunCleanupStage ¶
func (*StageManager) RunDeployStage ¶
func (*StageManager) RunDestroyStage ¶
func (*StageManager) RunInitStage ¶
RunInitStage executes the initialization stage logic for the deployment process.
func (*StageManager) RunPostDeployStage ¶
func (*StageManager) RunPostDestroyStage ¶
func (*StageManager) RunPreDeployStage ¶
type StageOrder ¶
type StageOrder struct {
Order []StageName // The order of stages to be executed
Funcs map[StageName]StageFunc // Mapping of stage names to their execution functions
}
StageOrder holds the ordered list of stage names and their corresponding functions.
type StageResult ¶
type StageResult string
type StageStatus ¶
type StageStatus string
type Stages ¶
type Stages struct {
Init *InitStageData
PreDeploy *PreDeployStageData
Deploy *DeployStageData
Destroy *DestroyStageData
PostDeploy *PostDeployStageData
PostDestroy *PostDestroyStageData
Cleanup *CleanupStageData
}
Stages holds the data for all stages in the deployment process.