Documentation
¶
Overview ¶
Package failure classifies a failed, held or unhealthy deploy into one structured object shared by the API, CLI and MCP surfaces.
Index ¶
Constants ¶
const ( CodeDockerfileError = "dockerfile_error" CodeDependencyInstall = "dependency_install_failed" CodeCompileError = "compile_error" CodeBuildStepFailed = "build_step_failed" CodeBuildConfigError = "build_config_error" CodeBuildOOM = "build_out_of_memory" CodeBuildTimeout = "build_timeout" CodeImagePullFailed = "image_pull_failed" CodeRegistryAuthFailed = "registry_auth_failed" CodePlatformMismatch = "platform_mismatch" CodeLockfileOutOfSync = "lockfile_out_of_sync" CodePortNotListening = "port_not_listening" CodeHealthCheckFailed = "health_check_failed" CodeContainerCrashed = "container_crashed" CodeOOMKilled = "oom_killed" CodeMissingEnv = "missing_env" CodeRegistryPushFailed = "registry_push_failed" CodeDiskFull = "disk_full" CodeImageCorrupt = "image_corrupt" CodeFreezeWindow = "freeze_window_hold" CodeApprovalPending = "approval_pending" CodeScanGateBlocked = "scan_gate_blocked" CodeRollbackTargetGone = "rollback_target_gone" CodeDockerUnreachable = "docker_unreachable" CodeBuildEngineNoBuild = "build_engine_unsupported" CodeGitHostUnreachable = "git_host_unreachable" CodeSourceNotCached = "source_not_cached" CodeUnknown = "unknown" )
Failure codes.
const ( EnvExcerptLines = "APP_FAILURE_EXCERPT_LINES" EnvExcerptBytes = "APP_FAILURE_EXCERPT_BYTES" )
Env vars that bound the log excerpt.
const EnvRolloutCrashLoopRestarts = "APP_DEPLOY_ROLLOUT_CRASHLOOP_RESTARTS"
EnvRolloutCrashLoopRestarts is how many restarts a rollout that never served may take before its CrashLoopBackOff counts as a failed deploy.
Variables ¶
var RolloutFailureReasons = map[string]bool{ "CreateFailed": true, "StartFailed": true, deploysafety.ReasonReadinessFailed: true, "InspectFailed": true, "EnsureNetworkFailed": true, "VanishedAfterStart": true, "PreDeployHookFailed": true, deploysafety.ReasonOOMKilledDuringReadiness: true, deploysafety.ReasonExitedDuringReadiness: true, deploysafety.ReasonOOMKilledDuringWindow: true, deploysafety.ReasonExitedDuringWindow: true, deploysafety.ReasonRestartedDuringWindow: true, deploysafety.ReasonGateTimeout: true, }
RolloutFailureReasons are the reconcile condition reasons that mean a finished build did not converge into a healthy container.
Functions ¶
func IsRolloutCrashLoop ¶
IsRolloutCrashLoop reports a CrashLoopBackOff condition whose restart count reached limit.
Types ¶
type Failure ¶
type Failure struct {
Code string `json:"code"`
Cause string `json:"cause"`
FailingStep string `json:"failing_step,omitempty"`
LogExcerpt string `json:"log_excerpt,omitempty"`
SuggestedFix string `json:"suggested_fix"`
DocsURL string `json:"docs_url"`
Retryable bool `json:"retryable"`
AlsoMatched []string `json:"also_matched,omitempty"`
Fixes []Fix `json:"fixes,omitempty"`
DeployID string `json:"deploy_id"`
App string `json:"app"`
At time.Time `json:"at"`
}
Failure is the structured description of why a deploy did not succeed.
type Fix ¶
type Fix struct {
Code string `json:"code"`
Kind string `json:"kind"`
Target string `json:"target,omitempty"`
Hint string `json:"hint"`
Match string `json:"match"`
}
Fix is a typed build-log suggestion: Kind says whether the control plane or the operator acts, Target names where a guided fix lives.
type Input ¶
type Input struct {
App string
DeployID string
Status string
Reason string
Error string
FailingStep string
Condition *Condition
LogLines []string
Crashloop bool
At time.Time
}
Input is everything Classify reads. Only Status is required.