deploykit

package
v0.2026189.1805 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 2 Imported by: 19 modules, 18 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package deploykit holds the InstallPlan step VOCABULARY — the 13 concrete InstallStep implementations + their field-structs + the pure classification helpers — that any deploy front-end (charly's host engine, an out-of-tree deploy plugin) imports. Each concrete step implements spec.InstallStep (homed in sdk/spec with the IR enums + the InstallPlan container). deploykit imports spec; the aliases below let the moved code read unchanged.

Index

Constants

View Source
const (
	ScopeSystem      = spec.ScopeSystem
	ScopeUser        = spec.ScopeUser
	ScopeUserProfile = spec.ScopeUserProfile

	PhasePrepare = spec.PhasePrepare
	PhaseInstall = spec.PhaseInstall
	PhaseCleanup = spec.PhaseCleanup

	VenueHostNative       = spec.VenueHostNative
	VenueContainerBuilder = spec.VenueContainerBuilder
	VenueSkip             = spec.VenueSkip

	GateNone             = spec.GateNone
	GateAllowRepoChanges = spec.GateAllowRepoChanges
	GateAllowRootTasks   = spec.GateAllowRootTasks
	GateWithServices     = spec.GateWithServices

	StepKindSystemPackages  = spec.StepKindSystemPackages
	StepKindBuilder         = spec.StepKindBuilder
	StepKindOp              = spec.StepKindOp
	StepKindFile            = spec.StepKindFile
	StepKindServicePackaged = spec.StepKindServicePackaged
	StepKindServiceCustom   = spec.StepKindServiceCustom
	StepKindShellHook       = spec.StepKindShellHook
	StepKindShellSnippet    = spec.StepKindShellSnippet
	StepKindRepoChange      = spec.StepKindRepoChange
	StepKindApkInstall      = spec.StepKindApkInstall
	StepKindLocalPkgInstall = spec.StepKindLocalPkgInstall
	StepKindReboot          = spec.StepKindReboot
	StepKindExternalPlugin  = spec.StepKindExternalPlugin

	ReverseOpCoprDisable    = spec.ReverseOpCoprDisable
	ReverseOpPackageRemove  = spec.ReverseOpPackageRemove
	ReverseOpRemoveDropin   = spec.ReverseOpRemoveDropin
	ReverseOpRemoveEnvdFile = spec.ReverseOpRemoveEnvdFile
	ReverseOpRemoveManaged  = spec.ReverseOpRemoveManaged
	ReverseOpRemoveRepoFile = spec.ReverseOpRemoveRepoFile
	ReverseOpRestoreEnabled = spec.ReverseOpRestoreEnabled
	ReverseOpRmFileSystem   = spec.ReverseOpRmFileSystem
	ReverseOpRmFileUser     = spec.ReverseOpRmFileUser
	ReverseOpServiceDisable = spec.ReverseOpServiceDisable
	ReverseOpServiceRemove  = spec.ReverseOpServiceRemove
)

Variables

This section is empty.

Functions

func PathIsSystemScoped

func PathIsSystemScoped(p string) bool

PathIsSystemScoped returns true for paths under /etc, /usr, /var, /opt, /root, /boot and similar system locations. Used to classify FileStep scope when the compiler hasn't explicitly tagged it.

Types

type ApkInstallStep

type ApkInstallStep struct {
	Packages  []ApkPackageSpec
	CandyName string
	CandyDir  string // candy source dir — anchors relative committed-APK paths
}

ApkInstallStep installs Android apps onto a `kind: android` device. It is the IR form of a candy's `apk:` package section — the apk "package format" (parallel to SystemPackagesStep for rpm/deb/pac, and BuilderStep for aur).

Unlike every other step, an apk install lands on a RUNNING Android device, not the build/host filesystem. `target: android` is an EXTERNAL deploy substrate (F1): NO in-proc DeployTarget executes this step — the host-side android deploy preresolver (collectAndroidInstalls, android_deploy_preresolve.go) READS it to collect the apk install specs and ships them to the deploy:android plugin (candy/plugin-adb: apkeep + adb), which drives the device. Every DeployTarget SKIPS it — OCITarget emits nothing (no device at image-build time), and Local/Vm/Pod targets record a skip (a host/VM/pod is not an Android device). This is the same "wrong venue → skip" shape `aur:` uses off-Arch, expressed as a clean recorded skip rather than an error (an image legitimately builds without installing apps).

func (*ApkInstallStep) Kind

func (s *ApkInstallStep) Kind() StepKind

func (*ApkInstallStep) RequiresGate

func (s *ApkInstallStep) RequiresGate() Gate

func (*ApkInstallStep) Reverse

func (s *ApkInstallStep) Reverse() []ReverseOp

Reverse returns no STATIC ledger ops — Android teardown ops are DYNAMIC, recorded from the deploy:android plugin's OpExecute reply (the uninstall reverse ops) at deploy time, replayed at `charly bundle del` like any external deploy substrate.

func (*ApkInstallStep) Scope

func (s *ApkInstallStep) Scope() Scope

Scope is system — installing an app mutates device-global package state.

func (*ApkInstallStep) Venue

func (s *ApkInstallStep) Venue() Venue

Venue is host-native — the android deploy preresolver reads this step from the host (the install itself runs in the deploy:android plugin over the wire).

type ApkPackageSpec

type ApkPackageSpec = spec.ApkPackageSpec

type ArtifactRef

type ArtifactRef struct {
	ContainerPath string // path inside the builder stage/container
	HostPath      string // path on the deploy target (host fs or final-image fs)
	Chown         bool   // whether to re-own to the target user
}

ArtifactRef describes an output path from a builder that needs to be extracted back to the host or copied into the final OCI image.

For user-scope pixi/npm/cargo on the host target: the host path is bind-mounted into the builder, so there's no "extraction" — the Artifacts list is empty because the bind-mount already put the files in place. For aur: the list contains /tmp/aur-pkgs/*.pkg.tar.zst, which the host target pulls out to a staging dir then hands to pacman.

type BuilderDef

type BuilderDef = spec.BuilderDef

type BuilderStep

type BuilderStep struct {
	Builder      string        // "pixi" | "npm" | "cargo" | "aur"
	BuilderImage string        // resolved image ref (e.g. "fedora-builder:2026.04")
	CandyName    string        // layer that triggered this builder (for ledger)
	CandyDir     string        // absolute layer source path (bind-mounted as /work)
	Phase        Phase         // typically PhaseInstall
	Artifacts    []ArtifactRef // outputs to extract (empty for user-scope pixi/npm/cargo; populated for aur)

	// Builder-specific template context — the compiler populates this from
	// the candy's manifest files + the embedded builder definition (charly/charly.yml).
	RawStageContext map[string]any

	// LocalPkg is the package format's localpkg contract, populated by the
	// compiler for the `aur` builder only. The aur builder produces package
	// files (.pkg.tar.zst) that the host/VM deploy targets install onto the
	// venue via the SAME config-driven transfer+install leg the localpkg step
	// uses (R3) — so the install command + package glob come from
	// the embedded `pac.local_pkg` vocabulary, never a hardcoded literal. Nil for
	// pixi/npm/cargo (home-artifact builders, no package-file install).
	LocalPkg *LocalPkgDef

	// BuilderDef is the resolved builder definition from the embedded build vocabulary (charly/charly.yml) for this builder
	// (img.BuilderConfig.Builder[Builder]), populated by the compiler. The
	// host-venue deploy targets render its phase.install.host cell via
	// renderBuilderScript — the plain-shell analog of the container stage — so the
	// host build script is config-driven, not hardcoded Go. nil only on
	// synthetic test paths that don't supply a BuilderConfig.
	BuilderDef *BuilderDef

	// PreResolvedReverse is the builder's teardown ops, resolved HOST-SIDE in the build
	// PRE-PASS (builder_preresolve.go → the externalized builder plugin's OpReverse) and stashed
	// here so Reverse() is a PURE getter — the per-builder reverse-op KIND (pixi-env-remove /
	// package-remove / …) is exactly the logic externalized out-of-process, and Reverse() runs
	// host-side (step-view projection + RunHostStep) with no registry handle. Carried across the
	// wire on InstallStepView.ReverseOps (the host-computed teardown field) and restored by
	// stepFromView. Nil for a custom candy builder / a direct compile with no pre-pass.
	PreResolvedReverse []ReverseOp
}

BuilderStep runs a multi-stage builder (pixi/npm/cargo/aur). On the OCI target this emits a FROM + RUN stage plus a final-stage COPY --from. On the host target this emits a `podman run <builder>` with HOME-remap and appropriate bind-mounts.

func (*BuilderStep) Kind

func (s *BuilderStep) Kind() StepKind

func (*BuilderStep) RequiresGate

func (s *BuilderStep) RequiresGate() Gate

func (*BuilderStep) Reverse

func (s *BuilderStep) Reverse() []ReverseOp

func (*BuilderStep) Scope

func (s *BuilderStep) Scope() Scope

func (*BuilderStep) Venue

func (s *BuilderStep) Venue() Venue

type CacheMountDef

type CacheMountDef = spec.CacheMount

type CacheMountSpec

type CacheMountSpec struct {
	Dst     string
	Sharing string // "locked" | "private" | "shared" | ""
}

CacheMountSpec mirrors the BuildKit cache-mount configuration carried in the embedded build vocabulary's format/builder definitions (charly/charly.yml). The OCI target renders these as `--mount=type=cache,...`; the host target ignores them.

type ExternalPluginStep

type ExternalPluginStep struct {
	Op           *Op      // the run: step op — Plugin (verb word) + PluginInput + RunAs
	CandyName    string   // owning candy (provenance + the ledger CandyRecord key)
	ResolvedUser string   // uid:gid or "root" after resolveUserSpec — drives Scope
	Distros      []string // the image's distro tag chain (img.Tags) for the build-emit BuildEnv
}

ExternalPluginStep is the install-timeline IR node for a `run: plugin: <verb>` step whose verb is served by an EXTERNAL (out-of-process) plugin — a grpcProvider, not a built-in TypedStepProvider (package/service) or ProvisionActor (the state-provision shell verbs) or the `command` install verb. compileActOp routes it here; the Invoke op is picked per venue, placement-agnostic above the registry:

  • the DEPLOY venue (the install runs ON the target, not into an image): BOTH target:local AND target:vm externalized, so an ExternalPluginStep on a deploy is reached by the external local/vm plugin's kit.WalkPlans, which routes it through the host's RunHostStep (the nested ExternalPluginStep case) → executeExternalPluginStep → Invoke(OpExecute) WITH the live DeployExecutor on the go-plugin broker (the E3b reverse channel), so the plugin runs its deploy-context effect (RunSystem/RunUser) on the real venue and RETURNS its teardown ReverseOps which the host records into the ledger (record-and-replay — only recorded ops are reversed at `charly bundle del`). This is the deploy-context counterpart of the build-context OpEmit leg (tasks.go emitPluginFragment), reusing the SAME spec.DeployReply / ReverseOp wire as the external deploy TARGET (deploy_target_external.go) — R3.
  • EmitOCI (a BUILD venue — the pod-overlay Containerfile): Invoke(OpEmit) via the SHARED emitPluginFragment, splicing the plugin's Containerfile FRAGMENT verbatim — it cannot deploy-execute at build (no live venue). Identical behaviour to the box-build path (writeCandySteps → emitTasks `case "plugin"`), just relocated. EmitOCI is the ONLY in-proc Emit* this provider still implements.

Reverse() is static-nil: the reversal ops are DYNAMIC — they come from the plugin's OpExecute reply at emit time, recorded by the host's RunHostStep handler into the CandyRecord (the externalDeployTarget record-and-replay pattern).

func (*ExternalPluginStep) Kind

func (s *ExternalPluginStep) Kind() StepKind

func (*ExternalPluginStep) RequiresGate

func (s *ExternalPluginStep) RequiresGate() Gate

RequiresGate is GateNone — an external plugin verb-step is operator-authorized build/deploy-time plugin execution (the candy author opted into it), mirroring the external deploy TARGET which is ungated; the plugin picks its own privilege via RunSystem/RunUser on the reverse channel.

func (*ExternalPluginStep) Reverse

func (s *ExternalPluginStep) Reverse() []ReverseOp

Reverse is static-nil: the teardown ops are recorded DYNAMICALLY from the plugin's OpExecute DeployReply at emit time (EmitLocal/EmitVM append reply.ReverseOps to the CandyRecord), exactly like the external deploy target — never recomputed.

func (*ExternalPluginStep) Scope

func (s *ExternalPluginStep) Scope() Scope

Scope classifies by the step's user context — the SAME rule OpStep uses (OpStepScope): root/empty → system, a named/numeric non-root user → user. The plugin then chooses RunSystem vs RunUser on the reverse channel per its own effect; this scope drives only the ledger reverse-op privilege bookkeeping.

func (*ExternalPluginStep) Venue

func (s *ExternalPluginStep) Venue() Venue

type FileStep

type FileStep struct {
	Source    string      // path to source content (under layer dir or .build/_inline/)
	Dest      string      // absolute destination path
	Mode      os.FileMode // permissions
	Owner     string      // "root" or "uid:gid" or the invoking user's name
	CandyName string      // for ledger
}

FileStep places a single file. The compiler may emit these for candy-declared file directives that aren't wrapped as tasks (e.g. supervisord fragment assembly). Today's tasks.go handles most file placement via OpStep; FileStep exists for cases where the compiler synthesizes file writes that weren't in the candy manifest (e.g. service unit files, managed-block contents).

func (*FileStep) Kind

func (s *FileStep) Kind() StepKind

func (*FileStep) RequiresGate

func (s *FileStep) RequiresGate() Gate

func (*FileStep) Reverse

func (s *FileStep) Reverse() []ReverseOp

func (*FileStep) Scope

func (s *FileStep) Scope() Scope

func (*FileStep) Venue

func (s *FileStep) Venue() Venue

type Gate

type Gate = spec.Gate

type LocalPkgDef

type LocalPkgDef = spec.LocalPkg

type LocalPkgInstallStep

type LocalPkgInstallStep struct {
	PkgbuildRef string // the layer's `localpkg:` value (e.g. "pkg/arch") — a hint, resolved at emit
	CandyName   string
	CandyDir    string // layer source dir — one anchor for the relative PKGBUILD search
	ProjectDir  string // the deploy project dir (os.Getwd() at deploy time) — the other anchor

	// Format is the package-format name whose `local_pkg:` config drives this
	// step (e.g. "pac"). "" when the target distro declares no localpkg-capable
	// format — the executor then treats the step as a clean no-op.
	Format string

	// LocalPkg is the format's localpkg contract resolved from the embedded build vocabulary (charly/charly.yml) at
	// compile time (DistroDef.LocalPkgFormat). It carries the build/install
	// templates, package glob, source-dir sentinel, and probe command — so the
	// executor renders every package-manager command from config instead of
	// hardcoding build/install/glob literals. The install command auto-resolves
	// the package's dependencies from the target's repos (pacman -U / dnf
	// install / apt-get install), so there is no dep-closure builder. Nil when
	// Format == "".
	LocalPkg *LocalPkgDef
}

--------------------------------------------------------------------------- LocalPkgInstallStep — build a bundled PKGBUILD on the host (makepkg) and install the resulting `.pkg.tar.zst` onto a pac-based deploy target. ---------------------------------------------------------------------------

LocalPkgInstallStep is the IR form of a candy's `localpkg:` field — a pointer at a bundled Arch PKGBUILD directory (relative to the candy dir or the project root). It is the proper-package counterpart of the charly candy's ad-hoc curl-a-binary `cmd:` task: on an Arch/CachyOS DEPLOY target the package is built from the repo's bundled PKGBUILD on the HOST (`makepkg`), the resulting artifact is transferred to the target, and `pacman -U`-installed — so `charly` lands as the tracked `opencharly-git` package at /usr/bin/charly rather than an untracked binary at /usr/local/bin/charly.

Like ApkInstallStep, the step is compiled REGARDLESS of target and each DeployTarget decides whether to execute or skip:

  • the external local deploy (Arch/CachyOS host) and external vm deploy (Arch/CachyOS guest) EXECUTE it via the RunHostStep host-engine leg (build on host → transfer → pacman -U on the target).
  • On a NON-pac deploy target the executor records a clean skip (a Fedora / Debian host has no pacman; the candy's own `cmd:` task curls the binary there as the documented fallback).
  • The IMAGE build (generate.go writeCandySteps) AND the pod-overlay build-emit RENDER the localpkg IMAGE install via renderLocalPkgImageInstall: a PRODUCTION box DOWNLOADS the published release, a DISPOSABLE check bed BUILDS the in-development package on the host and COPYs it in (both install via the SAME dep-resolving install template). The pod-overlay build-emit routes through candy/plugin-installstep's `step:local-pkg-install` OpEmit, which calls back the host `step-emit` seam (stepEmitLocalPkgInstall) — the build engine stays in core. A distro with no localpkg-capable format (LocalPkg==nil) renders nothing; the candy's own COPY/curl `cmd:` task is the fallback there.
  • the android / k8s substrates (external) SKIP it (no Arch package surface).

The PKGBUILD location is resolved at EMIT time (not compile time), so the step carries only the author's hint (`PkgbuildRef`) plus the candy's source dir + the deploy project dir for the walk-up search. When no PKGBUILD is found the step is a no-op (the candy's existing curl/COPY task is the fallback).

func (*LocalPkgInstallStep) Kind

func (s *LocalPkgInstallStep) Kind() StepKind

func (*LocalPkgInstallStep) RequiresGate

func (s *LocalPkgInstallStep) RequiresGate() Gate

func (*LocalPkgInstallStep) Reverse

func (s *LocalPkgInstallStep) Reverse() []ReverseOp

Reverse returns no ledger ops — the package is the deploy substrate's own pacman-tracked package, removed (if ever) via `pacman -R opencharly-git` by the operator, not by deploy teardown. Mirrors ApkInstallStep's empty Reverse.

func (*LocalPkgInstallStep) Scope

func (s *LocalPkgInstallStep) Scope() Scope

Scope is system — installing a pacman package mutates global package state.

func (*LocalPkgInstallStep) Venue

func (s *LocalPkgInstallStep) Venue() Venue

Venue is host-native — makepkg runs on the host (like the aur builder), then the artifact is shipped to the target and installed via pacman.

type Op

type Op = spec.Op

type OpStep

type OpStep struct {
	Op           *Op
	CandyName    string
	CandyDir     string
	CtxPath      string // absolute layer-dir path replacing "/ctx/" on host
	ResolvedUser string // uid:gid or "root" after resolveUserSpec

	// To is the home-resolved copy/download destination for the DEPLOY path.
	// The compiler tokenizes the task's `to:` (~ / ${HOME} / $HOME → {{.Home}})
	// here; InstallPlan.ResolveHome substitutes the destination's real home at
	// emit. execTask uses this (not the raw Task.To) for PutFile, so a
	// `copy: to: ${HOME}/...` lands in the actual guest/host home instead of a
	// literal "${HOME}" directory under sudo (HOME=/root). Empty when the task
	// has no `to:`. The OCI build emitter reads Task.To directly (build-time
	// ENV expands ${HOME}), so it is unaffected by this field.
	To string

	// CandyVars are the candy manifest `vars:` map propagated into the task
	// script as exports. Build-time gets these via Containerfile ENV
	// directives (emitVarsEnv); host/local-deploy time has no equivalent
	// mechanism, so the renderer emits `export K=V` lines from this field.
	// Without this, candies like `kubernetes` whose download URLs reference
	// ${K3D_VERSION} fetched an empty path-component at deploy time and
	// curl 404'd.
	CandyVars map[string]string

	// Distros is the image's distro tag chain (img.Tags), carried so the act-emit
	// enabler can pass it to a state-provision plugin verb's RenderProvisionScript
	// (e.g. the cross-distro package resolution). Empty for non-plugin ops; the
	// unix_group act ignores it, but a future package/service state-provision plugin
	// reads it.
	Distros []string
}

OpStep wraps a raw Op so the IR compiler doesn't have to transform it further. The OCI target and host target both understand Op shapes (cmd / mkdir / copy / write / link / download / setcap / build) and emit the appropriate directives. CtxPath substitutes for /ctx/ in cmd bodies on the host target (container RUN directives keep /ctx via bind-mount, which doesn't exist on the host).

func (*OpStep) Kind

func (s *OpStep) Kind() StepKind

func (*OpStep) RequiresGate

func (s *OpStep) RequiresGate() Gate

func (*OpStep) Reverse

func (s *OpStep) Reverse() []ReverseOp

func (*OpStep) Scope

func (s *OpStep) Scope() Scope

func (*OpStep) Venue

func (s *OpStep) Venue() Venue

type Phase

type Phase = spec.Phase

type RebootStep

type RebootStep struct {
	CandyName string
}

RebootStep requests a reboot of the deploy target after this candy's steps. It is emitted (last in the candy) when a candy declares `reboot: true` — the canonical case is a kernel-module candy (e.g. nvidia-open-dkms) whose module only loads on a fresh boot with nouveau blacklisted.

Only a rebootable venue acts on it: the external vm deploy reboots the guest over SSH (the host's RunHostStep RebootStep handler, gated on the rebootable-venue flag the vm substrate sets) and waits for the boot_id to change. OCITarget / PodDeployTarget have no machine to reboot at build time and skip it (the external k8s substrate does not consume the IR at all); the external local deploy refuses to reboot the host venue unattended (skip + note). Mirrors the ApkInstallStep "only one target executes" pattern.

func (*RebootStep) Kind

func (s *RebootStep) Kind() StepKind

func (*RebootStep) RequiresGate

func (s *RebootStep) RequiresGate() Gate

func (*RebootStep) Reverse

func (s *RebootStep) Reverse() []ReverseOp

Reverse is empty — a reboot is not a persistent artifact to undo.

func (*RebootStep) Scope

func (s *RebootStep) Scope() Scope

func (*RebootStep) Venue

func (s *RebootStep) Venue() Venue

type RepoChangeStep

type RepoChangeStep struct {
	Format    string // "rpm" | "deb" | "pac"
	File      string // absolute path of the repo file
	Content   string // rendered repo file body
	Checksum  string // sha256 of Content, for idempotency check at install
	CandyName string
}

RepoChangeStep records a repo config file mutation (e.g. adding rpmfusion-free.repo to /etc/yum.repos.d/). Distinct from SystemPackagesStep's PhasePrepare because the compiler often synthesizes these from `cmd:` tasks that happen to install a -release.rpm — we want them tracked separately so `charly bundle del` can reverse them precisely.

func (*RepoChangeStep) Kind

func (s *RepoChangeStep) Kind() StepKind

func (*RepoChangeStep) RequiresGate

func (s *RepoChangeStep) RequiresGate() Gate

func (*RepoChangeStep) Reverse

func (s *RepoChangeStep) Reverse() []ReverseOp

func (*RepoChangeStep) Scope

func (s *RepoChangeStep) Scope() Scope

func (*RepoChangeStep) Venue

func (s *RepoChangeStep) Venue() Venue

type RepoSpec

type RepoSpec struct {
	// Fields captured verbatim from the candy manifest. Different formats use
	// different subsets (rpm has url/id/key; deb has suite/components;
	// pac has url/keys). Carried as map so the template-rendered host
	// and container forms can pick what they need.
	Raw map[string]any
}

type ReverseOp

type ReverseOp = spec.ReverseOp

type ReverseOpKind

type ReverseOpKind = spec.ReverseOpKind

type Scope

type Scope = spec.Scope

func OpStepScope

func OpStepScope(userDir string) Scope

type ServiceCustomStep

type ServiceCustomStep struct {
	Name        string // e.g. "charly-ollama-ollama"
	UnitText    string // fully rendered unit content
	UnitPath    string // absolute install path
	TargetScope Scope  // ScopeSystem or ScopeUser
	Enable      bool
	CandyName   string
}

ServiceCustomStep writes and enables a full service definition. The unit text is already rendered by the compiler from the candy's generic `services:` entry via the target init system's service_template.

func (*ServiceCustomStep) Kind

func (s *ServiceCustomStep) Kind() StepKind

func (*ServiceCustomStep) RequiresGate

func (s *ServiceCustomStep) RequiresGate() Gate

func (*ServiceCustomStep) Reverse

func (s *ServiceCustomStep) Reverse() []ReverseOp

func (*ServiceCustomStep) Scope

func (s *ServiceCustomStep) Scope() Scope

func (*ServiceCustomStep) Venue

func (s *ServiceCustomStep) Venue() Venue

type ServicePackagedStep

type ServicePackagedStep struct {
	Unit          string // e.g. "postgresql.service"
	TargetScope   Scope  // ScopeSystem → /etc/systemd/system/; ScopeUser → ~/.config/systemd/user/
	Enable        bool
	OverridesText string // rendered drop-in (.conf) content; "" if no overrides
	OverridesPath string // computed absolute path for the drop-in file
	CandyName     string // for ledger + drop-in naming
	PriorEnabled  bool   // populated at install time (before enable); used for teardown restore
}

ServicePackagedStep enables a systemd unit that arrived via a distro package (e.g. postgresql.service). Optional drop-in overrides are written alongside the packaged unit without touching it. This step is only emitted when rendering to a systemd-based init system; supervisord targets emit a warning-and-skip.

func (*ServicePackagedStep) Kind

func (s *ServicePackagedStep) Kind() StepKind

func (*ServicePackagedStep) RequiresGate

func (s *ServicePackagedStep) RequiresGate() Gate

func (*ServicePackagedStep) Reverse

func (s *ServicePackagedStep) Reverse() []ReverseOp

func (*ServicePackagedStep) Scope

func (s *ServicePackagedStep) Scope() Scope

func (*ServicePackagedStep) Venue

func (s *ServicePackagedStep) Venue() Venue

type ShellHookStep

type ShellHookStep struct {
	CandyName string
	EnvVars   map[string]string
	PathAdd   []string // already {{.Home}}-substituted to absolute paths
	EnvFile   string   // computed path (~/.config/opencharly/env.d/<candy>.env); populated at install
}

ShellHookStep records the env vars and PATH contributions a candy makes to the user's shell environment. On the OCI target these translate to `ENV K=V` directives in the Containerfile. On the host target they become `~/.config/opencharly/env.d/<candy>.env` plus a managed block in the user's shell init that sources the env.d directory.

func (*ShellHookStep) Kind

func (s *ShellHookStep) Kind() StepKind

func (*ShellHookStep) RequiresGate

func (s *ShellHookStep) RequiresGate() Gate

func (*ShellHookStep) Reverse

func (s *ShellHookStep) Reverse() []ReverseOp

func (*ShellHookStep) Scope

func (s *ShellHookStep) Scope() Scope

func (*ShellHookStep) Venue

func (s *ShellHookStep) Venue() Venue

type ShellSnippetStep

type ShellSnippetStep struct {
	CandyName   string   // candy this snippet belongs to (also Marker source)
	Origin      string   // "<candy>" or "box" or "deploy" (for ledger refcount + LabelShell origin)
	Shell       string   // bash | zsh | fish | sh
	Snippet     string   // rendered body, ${SHELL_NAME}-substituted, ready to write
	PathAppend  []string // already rendered into Snippet by the compiler; tracked here for label round-trip / overlay
	Destination string   // resolved per-target at compile time; absolute path on the target
	Marker      string   // managed-block marker tag (= CandyName) — consumed by the kit walk's managed-block splice (sdk/kit/profile.go)
	UseDropin   bool     // true: write whole file (fish, container drop-in); false: managed-block append into existing rc file
	Priority    int      // load-order hint, 0 = default
}

ShellSnippetStep records a per-(candy, shell) init snippet emitted from a candy's `shell:` block. The compiler emits one step per (candy, shell) pair after applying the selection rule (per-shell ByShell entry wins over generic, with ${SHELL_NAME} substitution).

Per-target rendering:

  • OCITarget: snippet bytes are content-address-staged and COPYed to a system-wide drop-in (/etc/profile.d/charly-<candy>.sh for bash/zsh/sh, /etc/fish/conf.d/charly-<candy>.fish for fish).
  • the external local / vm deploy (kit.WalkPlans on the venue): managed-block append to the user's rc file (~/.bashrc, ~/.zshrc, ~/.profile) keyed by `# opencharly:begin <Marker>` fence; for fish, a per-candy drop-in at ~/.config/fish/conf.d/charly-<candy>.fish (no fence needed, file IS the unit). UseDropin discriminates the two paths.
  • the external k8s substrate: does not consume the InstallPlan IR at all (the host generates a Kustomize tree separately — no shell snippet).

func (*ShellSnippetStep) Kind

func (s *ShellSnippetStep) Kind() StepKind

func (*ShellSnippetStep) RequiresGate

func (s *ShellSnippetStep) RequiresGate() Gate

func (*ShellSnippetStep) Reverse

func (s *ShellSnippetStep) Reverse() []ReverseOp

func (*ShellSnippetStep) Scope

func (s *ShellSnippetStep) Scope() Scope

Scope: SnippetStep is system-wide for build-mode (Container drop-ins live under /etc/profile.d/ — root-owned), and user-profile for host/vm deploy- mode (managed block in ~/.bashrc etc.). The compiler picks the right Scope when constructing the step based on the destination path; the step records the choice so each emitter doesn't have to re-derive it.

func (*ShellSnippetStep) Venue

func (s *ShellSnippetStep) Venue() Venue

type StepKind

type StepKind = spec.StepKind

type SystemPackagesStep

type SystemPackagesStep struct {
	Format   string     // "rpm" | "deb" | "pac"
	Phase    Phase      // PhasePrepare | PhaseInstall | PhaseCleanup
	Packages []string   // package names (for Reverse)
	Repos    []RepoSpec // repository entries from the candy manifest (drives PhasePrepare)
	Options  []string   // format-specific install flags
	Copr     []string   // RPM-only: COPR repos to enable/disable
	Modules  []string   // RPM-only: DNF modules to enable
	Exclude  []string   // RPM-only: packages to exclude
	Keys     []string   // PAC-only: GPG keys to trust

	// CacheMounts and RawInstallContext are passed to template rendering.
	// These are populated by the compiler and consumed by the OCI target;
	// the host target ignores CacheMounts (no BuildKit outside containers).
	CacheMount        []CacheMountSpec
	RawInstallContext map[string]any
}

SystemPackagesStep installs packages via a distro package manager. One step typically expands to (PhasePrepare + PhaseInstall + PhaseCleanup) stages; the compiler emits one SystemPackagesStep per phase so the host target can gate PhasePrepare on --allow-repo-changes.

func (*SystemPackagesStep) Kind

func (s *SystemPackagesStep) Kind() StepKind

func (*SystemPackagesStep) RequiresGate

func (s *SystemPackagesStep) RequiresGate() Gate

func (*SystemPackagesStep) Reverse

func (s *SystemPackagesStep) Reverse() []ReverseOp

func (*SystemPackagesStep) Scope

func (s *SystemPackagesStep) Scope() Scope

func (*SystemPackagesStep) Venue

func (s *SystemPackagesStep) Venue() Venue

type Venue

type Venue = spec.Venue

Jump to

Keyboard shortcuts

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