Documentation
¶
Overview ¶
Package cmd provides the CLI command implementations for Bosun.
Index ¶
- Constants
- func ExitCodeFromError(err error) int
- func NewConfigCmd() *cobra.Command
- func NewJobCmd() *cobra.Command
- func NewJobRunCmd() *cobra.Command
- func NewLabelsCmd() *cobra.Command
- func NewPlanCmd() *cobra.Command
- func NewPlanListCmd() *cobra.Command
- func NewPlanShowCmd() *cobra.Command
- func NewRootCmd() *cobra.Command
- func NewSnapshotCmd() *cobra.Command
- func NewValidateCmd() *cobra.Command
- type ConfigSource
- type EntityValidationError
- type ValidateOptions
- type ValidationResult
Constants ¶
const ( ExitSuccess = 0 ExitRuntimeError = 1 ExitValidationError = 2 // M3 additions ExitWorkerFailed = 10 // Worker exited with non-zero code ExitStopFailed = 11 // Failed to stop stack ExitStartFailed = 12 // Failed to restart stack ExitTimeout = 13 // Operation timed out ExitImageNotFound = 14 // Worker image not found ExitJobNotFound = 15 // Job name not found ExitInterrupted = 16 // Execution interrupted (Ctrl+C) )
Exit codes for Bosun CLI commands.
These constants ensure consistent exit code semantics across all commands:
- ExitSuccess: Command completed without errors
- ExitRuntimeError: Docker unavailable, I/O failure, network error
- ExitValidationError: Invalid labels, missing required fields, config errors
M3 Job Execution Exit Codes (10-16 range to avoid collision with existing):
- ExitWorkerFailed: Worker exited with non-zero code
- ExitStopFailed: Failed to stop stack
- ExitStartFailed: Failed to restart stack
- ExitTimeout: Operation timed out
- ExitImageNotFound: Worker image not found
- ExitJobNotFound: Job name not found
- ExitInterrupted: Execution interrupted (Ctrl+C)
Variables ¶
This section is empty.
Functions ¶
func ExitCodeFromError ¶
ExitCodeFromError maps domain errors to exit codes.
func NewConfigCmd ¶
NewConfigCmd creates the config subcommand group
func NewJobRunCmd ¶
NewJobRunCmd creates the `job run` subcommand.
func NewPlanCmd ¶
NewPlanCmd creates the plan command group for job planning operations.
func NewPlanListCmd ¶
NewPlanListCmd creates the `plan list` subcommand.
func NewPlanShowCmd ¶
NewPlanShowCmd creates the `plan show` subcommand.
func NewSnapshotCmd ¶
NewSnapshotCmd creates the snapshot subcommand
func NewValidateCmd ¶
NewValidateCmd creates the validate subcommand
Types ¶
type ConfigSource ¶
type ConfigSource string
ConfigSource indicates where config values come from
const ( // SourceAuto merges all sources (default) SourceAuto ConfigSource = "auto" // SourceLabels uses Docker labels only SourceLabels ConfigSource = "labels" // SourceFile uses config file only (future) SourceFile ConfigSource = "file" )
type EntityValidationError ¶
type EntityValidationError struct {
Entity dlabels.LabeledEntity // The entity that failed
Errors loader.ValidationErrors // Validation errors for this entity
}
EntityValidationError wraps validation errors with entity context
type ValidateOptions ¶
type ValidateOptions struct {
Source ConfigSource // --from flag
Scope string // --scope flag (empty = all)
PrintConfig bool // --print flag
ConfigFile string // --config flag (future)
IncludeStopped bool // --stopped flag
Strict bool // --strict flag
}
ValidateOptions holds CLI flag values
type ValidationResult ¶
type ValidationResult struct {
Valid bool // Overall success
MergedConfig *schema.ConfigV1 // Merged config (if valid or for --print)
EntityErrors []EntityValidationError // Per-entity errors (config labels)
JobErrors loader.JobValidationErrors // Job label validation errors
Warnings []string // Non-fatal warnings
}
ValidationResult holds the outcome of validation