Documentation
¶
Index ¶
Constants ¶
View Source
const ( ExternalType = "external" CommandType = "command" )
Variables ¶
This section is empty.
Functions ¶
func ValidateCallbacks ¶
Types ¶
type Callback ¶
type Callback struct {
Stage string `yaml:"stage"`
Pre CallbackParameters `yaml:"pre,omitempty"`
Post CallbackParameters `yaml:"post,omitempty"`
}
func (*Callback) IsValid ¶
IsValid checks if the Callback structure is valid. It ensures that the stage name is provided and that either pre or post parameters exist. Additionally, it validates the pre and post parameters if they are set.
Returns:
- error: An error if validation fails, otherwise nil.
func (Callback) PostRun ¶
func (c Callback) PostRun(ctx context.Context, wg *sync.WaitGroup, logger interfaces.BuildLogger)
func (Callback) PreRun ¶
func (c Callback) PreRun(ctx context.Context, wg *sync.WaitGroup, logger interfaces.BuildLogger)
type CallbackParameters ¶
type CallbackParameters struct {
Type string `yaml:"type"`
Action string `yaml:"action"`
Method string `yaml:"method,omitempty"`
Parameters []string `yaml:"parameters,omitempty"`
}
func (*CallbackParameters) IsValid ¶
func (c *CallbackParameters) IsValid() error
IsValid checks if the CallbackParameters structure is valid. It performs type, method, action, and parameters validation.
Returns:
- error: An error if validation fails, otherwise nil.
func (*CallbackParameters) Run ¶
func (c *CallbackParameters) Run(ctx context.Context, logger interfaces.BuildLogger) error
Run executes the callback based on its type (external or command). It first validates the callback parameters, then either runs an external HTTP request or a system command depending on the `Type` of the callback.
Parameters:
- ctx (context.Context): The context for the execution, used for cancellation and timeouts.
- logger (BuildLogger): The logger to record any logs or errors during execution.
Returns:
- error: Returns an error if validation fails or if execution of the callback fails.
Click to show internal directories.
Click to hide internal directories.