failure

package
v0.2.0-beta.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

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

View Source
const (
	CodeDockerfileError    = "dockerfile_error"
	CodeDependencyInstall  = "dependency_install_failed"
	CodeCompileError       = "compile_error"
	CodeBuildConfigError   = "build_config_error"
	CodeBuildOOM           = "build_out_of_memory"
	CodeBuildTimeout       = "build_timeout"
	CodeImagePullFailed    = "image_pull_failed"
	CodePortNotListening   = "port_not_listening"
	CodeHealthCheckFailed  = "health_check_failed"
	CodeContainerCrashed   = "container_crashed"
	CodeOOMKilled          = "oom_killed"
	CodeMissingEnv         = "missing_env"
	CodeRegistryPushFailed = "registry_push_failed"
	CodeDiskFull           = "disk_full"
	CodeFreezeWindow       = "freeze_window_hold"
	CodeApprovalPending    = "approval_pending"
	CodeScanGateBlocked    = "scan_gate_blocked"
	CodeRollbackTargetGone = "rollback_target_gone"
	CodeDockerUnreachable  = "docker_unreachable"
	CodeUnknown            = "unknown"
)

Failure codes.

View Source
const (
	EnvExcerptLines = "APP_FAILURE_EXCERPT_LINES"
	EnvExcerptBytes = "APP_FAILURE_EXCERPT_BYTES"
)

Env vars that bound the log excerpt.

Variables

View Source
var RolloutFailureReasons = map[string]bool{
	"CreateFailed":             true,
	"StartFailed":              true,
	"ReadinessFailed":          true,
	"InspectFailed":            true,
	"EnsureNetworkFailed":      true,
	"VanishedAfterStart":       true,
	"PreDeployHookFailed":      true,
	"OOMKilledDuringReadiness": true,
	"ExitedDuringReadiness":    true,
}

RolloutFailureReasons are the reconcile condition reasons that mean a finished build did not converge into a healthy container.

Functions

This section is empty.

Types

type Condition

type Condition struct {
	Reason  string
	Message string
}

Condition is one failing reconcile condition.

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"`
	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.

func Classify

func Classify(in Input, opts Options) (Failure, bool)

Classify returns the Failure for in, or false when the deploy is not in a failing or blocked state.

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.

type Options

type Options struct {
	MaxLines int
	MaxBytes int
}

Options bound the log excerpt.

func OptionsFromEnv

func OptionsFromEnv(lookup func(string) (string, bool)) Options

OptionsFromEnv reads Options from lookup, falling back to defaults.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL