deploy

package
v0.2026268.2152 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 5 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TaskAutoExports = map[string]bool{
	"USER":       true,
	"UID":        true,
	"GID":        true,
	"HOME":       true,
	"ARCH":       true,
	"BUILD_ARCH": true,
}

TaskAutoExports are the auto-exported variable names reserved for the generator; `vars:` entries may not shadow these, and every `${VAR}` reference resolves against (auto-exports ∪ candy.Vars).

Functions

func BedCheckLiveRefs

func BedCheckLiveRefs(name string, node *spec.DeployNode) []string

BedCheckLiveRefs returns the ordered `charly check live` targets for a bed: the substrate itself first, then each IN-SUBSTRATE member as a dotted path in authored order. A `target: android` member shares the parent pod's venue (Descent.Venue == "parent") and has no own image — its app-presence checks are baked into the parent ref, so it is skipped. Pure + unit-tested.

func CandyArtifactRegisters

func CandyArtifactRegisters(layers []spec.CandyReader) map[string]bool

CandyArtifactRegisters returns the DISTINCT `register:` hints declared across every candy's artifact list — name-blind (it reads each artifact's own declaration, never a candy name).

func CandyMapKey

func CandyMapKey(layer spec.CandyReader) string

CandyMapKey returns the candy's map key: the full @github ref for a remote candy (RepoPath/SubPathPrefix+Name), else the bare Name. A ROOT-LEVEL remote candy (the candy de-submodule cutover — a standalone candy repo whose manifest lives at the repo root, SubPathPrefix "") keys as the repo path itself: appending the name would double it (github.com/org/layer-ripgrep/layer-ripgrep).

func CandyStageDirName

func CandyStageDirName(layer spec.CandyReader) string

CandyStageDirName returns the content-addressed staging dir name for a remote candy's copied tree (name.version).

func ClassifyNodeTarget

func ClassifyNodeTarget(node *spec.DeployNode, path string) string

ClassifyNodeTarget picks the target discriminator for a node. Uses node.Target when non-empty (canonical pod|vm|kubernetes|local|android|kindcluster, set from the node-form kind by the loader's deployTargetForDisc). For ref-based deploys with no charly.yml entry, the deploy name itself is the hint: a literal `host`/`local` LEAF → local target; anything else → pod. A pure function of node+path with no LoadUnified/executor dependency.

func DeployNestedLocalChildren

func DeployNestedLocalChildren(parent string, node *spec.DeployNode, apply func(memberKey, dotted string) error) error

DeployNestedLocalChildren deploys a parent venue's IN-SUBSTRATE target:local members via the dotted-path dispatch — each host-rooted (local/SSH-shell) member applies its candies in place. Promoted from sdk/deploykit (#55 U4), now that HostRooted is a spec predicate; deploykit keeps a re-export forwarder so its charly callers compile unchanged.

plugin-deploy-vm's PostApply brings up nested target:pod members as in-guest quadlets, but it SKIPS target:local members — they carry no image, they apply candies in place. Without this loop a nested local member never deploys, and a deploy-scope check against it either fails or (worse) silently checks nothing.

Both sites that own a VM venue call it: the isVM bed ROOT and bringUpMembers' VM-member branch. They differ only in how a member deploy is executed (the root wraps it in a recorded step(); a member shells out directly), so that is the injected apply func.

func DescriptionInfo

func DescriptionInfo(d string) string

DescriptionInfo returns the first non-empty line of a candy/box description, trimmed.

func ExternalInPlaceVenue

func ExternalInPlaceVenue(node *spec.DeployNode) bool

ExternalInPlaceVenue reports whether node's stamped venue is an EXTERNAL deploy substrate that applies its workload IN PLACE — local-like: no container image to build, no `charly config`/`charly start`, teardown via `charly deploy del` (replay the recorded reverse ops). local/android/kubernetes/exampledeploy are in-place (parent/none venues); pod is the one externalized substrate that is NOT in-place (excluded by requiring venue != container implicitly, since parent/none never equals container). Mirrors HostRooted's shape (#55 W3 B2-full) — the plugin-reachable equivalent of the former core-private bedExternalInPlace(target string), which queried isExternalDeploySubstrate against the live provider registry: every node this predicate sees comes from an already-loaded, Descent-stamped project, so the registry round-trip was redundant with data already on the wire (the SAME finding candy/plugin-fleet's externalInPlaceFromDescent already proved for a bed's sibling MEMBERS — this promotes that one shared predicate for the bed ROOT too, R3).

func FindVMClaimant

func FindVMClaimant(tree map[string]spec.DeployNode, vmEntity, claimantID string) (string, spec.DeployNode, bool)

FindVMClaimant returns the node claiming the given VM entity via requires_exclusive.

When claimantID (a deploy KEY or a VmDomainIdentity — both compared after spec.VmDomainIdentity normalization) is non-empty, the lookup is IDENTITY-SCOPED: it resolves ONLY that exact node, so a sibling deploy sharing the same `from:` entity can never hijack this one's resource claim. This matters because MANY deploys routinely share one kind:vm entity (a 16-bed suite all `from: omarchy-vm`, exactly one of which carries `requires_exclusive: [nvidia-gpu]`) — an entity-wide scan made EVERY sibling inherit that GPU requirement (RCA: `check-omarchy-iso-vm`, a GPU-free bed, failed vm-create demanding an NVIDIA card present only on the hybrid-GPU bed's host).

Only when claimantID is EMPTY (the direct `charly vm create <entity>` path, which carries no deploy identity) does the legacy entity-wide scan run. In that path an entity claimed by more than one exclusive-resource node is AMBIGUOUS and returns false rather than picking an arbitrary map-order winner — the caller then treats the create as unclaimed, never as some other deploy's claim.

func HolderAddrFor

func HolderAddrFor(name string, node spec.DeployNode) spec.HolderAddr

HolderAddrFor derives the resource-arbiter holder address for a deploy-tree node — servable off a plain map[string]spec.DeployNode (the shape both a freshly-loaded uf.Deploy and a resolved-project envelope's Deploy map carry).

func HostRooted

func HostRooted(node *spec.DeployNode) bool

The uniform ordered member tree (Cutover C task 0) needs no sorted-key helper: the ONE ordered Member list is already deterministic in authored order. HostRooted reports whether node's stamped descent trait is host-rooted — the substrate's own ROOT executor runs directly on the host (a local/SSH-shell venue, not a container/VM venue). Reads the wire-stamped node.Descent directly (every node a LoadUnified'd project produces is Descent-stamped by StampDescent), so it needs no registry access. Promoted from sdk/deploykit's former private host-rooted predicate (#55 U4) so DeployNestedLocalChildren + the bed-session apply path (PersistBedDeployOverrides) share ONE predicate over the spec value type; deploykit callers repoint to spec/deploy.HostRooted directly.

func IsContainerVenue

func IsContainerVenue(node *spec.DeployNode) bool

IsContainerVenue reports whether node's stamped venue is the container-exec (pod) substrate. Mirrors HostRooted's shape (#55 W3 A4) — see IsVmVenue.

func IsVmVenue

func IsVmVenue(node *spec.DeployNode) bool

IsVmVenue reports whether node's stamped venue is the SSH-hop (vm) substrate. Mirrors HostRooted's shape (#55 W3 A4) — promoted so a plugin-side deploy-orchestration consumer (sdk/deploykit's BringUpMembers/TearDownMembers) and any future caller share ONE predicate over the wire-stamped node.Descent, instead of each re-deriving the venue check independently.

func MergeDeployNode

func MergeDeployNode(dst, src spec.DeployNode) spec.DeployNode

MergeDeployNode overlays src onto dst: every authored (yaml-tagged, non-zero) field of src wins, and the loader-DERIVED structural TREE fields (Target, the uniform ordered Member tree) merge explicitly (src non-zero wins). Pure (reflect over the spec.DeployNode value type).

func PathLeaf

func PathLeaf(path string) string

PathLeaf returns the last segment of a dotted deployment path. "foo.bar.baz" -> "baz"; "foo" -> "foo"; "" -> "". Unlike SplitDottedPath, a malformed path (leading/trailing/doubled dots) still yields its raw trailing segment rather than nil — callers that only care about the LEAF (e.g. a "host"/"local" literal-name check) want the tolerant form.

func ResolveNodePath

func ResolveNodePath(roots map[string]spec.DeployNode, path string) (*spec.DeployNode, []*spec.DeployNode, error)

ResolveNodePath resolves a dotted deployment path against a root map, returning the leaf node, its ancestor chain, and any lookup error.

func SplitDottedPath

func SplitDottedPath(path string) []string

SplitDottedPath splits a dotted deployment path into segments. An empty input or a path with any empty segment (leading/trailing/doubled dots) yields nil so callers can flag the error at their layer with the original offending path string.

func TaskKnownNames

func TaskKnownNames(vars map[string]string) map[string]bool

TaskKnownNames returns the ${NAME} references that resolve cleanly for this candy: auto-exports ∪ candy.Vars keys.

Types

This section is empty.

Jump to

Keyboard shortcuts

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