failure

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 9 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"
	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"
	CodeGitHostUnreachable = "git_host_unreachable"
	CodeSourceNotCached    = "source_not_cached"
	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

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

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

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