resolve

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package resolve implements resolution for the Build CR.

The Build CR stores its spec as a raw JSON contract (spec.contract) rather than typed Kubernetes fields. ResolveBuild decodes this raw contract into a fully typed ResolvedBuild — the authoritative runtime representation consumed by all downstream domain and application logic.

Resolution validates required fields, including the strategy, and enforces policy invariants (e.g. maxAttempts must be > 0 when retry is enabled). All failures surface as errors — resolution never panics. A panic in the resolution layer would crash the controller process.

Index

Constants

View Source
const (
	// StrategyKindCluster is a cluster-scoped build strategy.
	StrategyKindCluster = "ClusterBuildStrategy"
	// StrategyKindNamespaced is a build strategy in the Build's namespace.
	StrategyKindNamespaced = "NamespacedBuildStrategy"
)

Strategy kinds a Build contract may declare.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResolvedBuild

type ResolvedBuild struct {
	Build *environmentv1alpha1.Build
	Spec  *ResolvedBuildSpec
}

ResolvedBuild pairs the original Kubernetes Build object with its fully decoded and validated spec.

func ResolveBuild

func ResolveBuild(build *environmentv1alpha1.Build) (*ResolvedBuild, error)

ResolveBuild decodes and validates the raw JSON contract from the Build CR spec into a ResolvedBuild. Returns an error if the CR is nil, the contract is absent, or any required field is missing or malformed.

type ResolvedBuildPolicy

type ResolvedBuildPolicy struct {
	Triggers []ResolvedTrigger
	Retry    *ResolvedRetryPolicy
}

ResolvedBuildPolicy is the decoded trigger and retry policy for a Build. Both parts are optional: no Triggers means no event starts a build, and a nil Retry means a failed build is not retried.

type ResolvedBuildSpec

type ResolvedBuildSpec struct {
	Image          string
	Source         ResolvedSource
	Githubevent    string
	Strategy       ResolvedStrategy
	ServiceAccount *ResolvedServiceAccount
	// Policy is never nil after ResolveBuild. It is empty when the contract
	// declares no policy.
	Policy *ResolvedBuildPolicy
}

ResolvedBuildSpec is the decoded and validated Build spec.

type ResolvedRetryPolicy

type ResolvedRetryPolicy struct {
	OnFailure   bool
	MaxAttempts uint32
}

ResolvedRetryPolicy is the decoded retry behavior for a failed Build run.

type ResolvedServiceAccount

type ResolvedServiceAccount struct {
	Name   string
	Secret string
}

ResolvedServiceAccount is the decoded service account a Build's execution runs as.

type ResolvedSource

type ResolvedSource struct {
	URL         string
	Revision    string
	ContextDir  string
	CloneSecret string
}

ResolvedSource is the decoded source-repository configuration for a Build.

type ResolvedStrategy

type ResolvedStrategy struct {
	Name         string
	StrategyKind string
}

ResolvedStrategy is the decoded build strategy (e.g. Buildah, Kaniko, Buildpacks) selected for a Build. Both fields are required by resolution: Name is never empty and StrategyKind is one of the StrategyKind constants.

type ResolvedTrigger

type ResolvedTrigger struct {
	Type string
}

ResolvedTrigger is a single decoded trigger condition that can initiate a Build run.

Jump to

Keyboard shortcuts

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