plan

package
v1.13.4 Latest Latest
Warning

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

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

Documentation

Overview

Package plan builds, hashes, saves and verifies immutable deployment plans.

Index

Constants

View Source
const Schema = "forge.deploy.plan/v1"

Variables

This section is empty.

Functions

func Save

func Save(dir string, p *Plan) (string, error)

func SaveWithin

func SaveWithin(project string, p *Plan) (string, error)

func Verify

func Verify(p *Plan, inputs map[string]string) output.Diagnostics

Verify recomputes the hash and compares inputs with the current hashes.

Types

type OpKind

type OpKind string
const (
	OpBuild   OpKind = "build"
	OpPush    OpKind = "push"
	OpCreate  OpKind = "create"
	OpUpdate  OpKind = "update"
	OpDelete  OpKind = "delete"
	OpBind    OpKind = "bind"
	OpDeliver OpKind = "deliver"
	OpMigrate OpKind = "migrate"
	OpRollout OpKind = "rollout"
	OpRoute   OpKind = "route"
	OpCheck   OpKind = "check"
)

type Operation

type Operation struct {
	ID          string   `json:"id"`
	Kind        OpKind   `json:"kind"`
	Service     string   `json:"service,omitempty"`
	Resource    string   `json:"resource,omitempty"`
	Destructive bool     `json:"destructive"`
	DependsOn   []string `json:"depends_on,omitempty"`
	Detail      string   `json:"detail"`
}

type Plan

type Plan struct {
	Schema      string              `json:"schema"`
	Hash        string              `json:"hash"`
	CreatedAt   time.Time           `json:"created_at"`
	TTL         time.Duration       `json:"ttl"`
	Project     string              `json:"project"`
	Environment string              `json:"environment"`
	TargetName  string              `json:"target"`
	Target      spec.Target         `json:"target_spec"`
	Deployment  *model.Deployment   `json:"deployment"`
	Files       map[string]string   `json:"files"`
	Inputs      map[string]string   `json:"inputs"`
	Images      []model.Image       `json:"images"`
	Operations  []Operation         `json:"operations"`
	ObservedIDs map[string][]string `json:"observed_ids,omitempty"`
	Snapshot    state.Snapshot      `json:"snapshot"`
	Diagnostics output.Diagnostics  `json:"diagnostics"`
}

func Build

func Build(d *model.Deployment, b *render.Bundle, snap state.Snapshot, inputs map[string]string, ops []Operation) (*Plan, error)

func Decode

func Decode(data []byte) (*Plan, error)

func Load

func Load(path string) (*Plan, error)

func Recorded

func Recorded(root, hash, target, env string) (*Plan, error)

func (*Plan) Canonical

func (p *Plan) Canonical() ([]byte, error)

Canonical is the plan without Hash and CreatedAt, with every SecretRef reduced to name and resolver. encoding/json sorts map keys, and struct fields keep declaration order, so the output is stable.

func (*Plan) ComputeHash

func (p *Plan) ComputeHash() (string, error)

Jump to

Keyboard shortcuts

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