Skip to main content

BuildCtx

Struct BuildCtx 

Source
pub struct BuildCtx { /* private fields */ }
Expand description

Fragment registry snapshot, passed to container builds.

Implementations§

Source§

impl BuildCtx

Source

pub fn collect( krate: &str, version: &str, bin: &str, version_tag: Option<&str>, commit: Option<&str>, dirty: Option<&str>, ) -> BuildCtx

Emit-only: gathers fragments AND loads athena.toml. Never called in run-mode, so the in-pod binary needs no athena.toml. The version_tag/commit/dirty come from the build-time-baked option_env! consts threaded through entrypoint! (all None for a plain cargo build → release tag = kebab(version)).

Source

pub fn config(&self) -> &AthenaConfig

Source

pub fn artifact_key(&self) -> &str

The S3 object key of this binary’s tarball, {crate}/<version_tag>/{bin}.tar.gz.

Source

pub fn version_tag(&self) -> &str

The resolved, build-time-sealed version tag (kebab). Appended to every emitted WorkflowTemplate name, the S3 key segment, and the cargo.athena/tag label. Sealed in the binary — emit/submit read it, never recompute it from the local Cargo.toml/git.

Source

pub fn versioned_name(&self, base: &str) -> String

<base>-<tag> cluster-resource name. The tag overlay is purely a cluster-identity concern: in-pod dispatch + every templateRef.template stay on base (the versioning invariant). Fails loud at emit if the result would exceed DNS-1123’s 63-char limit — the user shortens the base with #[…(name = "…")].

Source

pub fn athena_labels(&self) -> BTreeMap<String, String>

Baseline provenance labels stamped onto every emitted WorkflowTemplate (and the --with-workflow runnable Workflow). All under the cargo.athena/* namespace - intentionally NOT in app.kubernetes.io/*, despite the convention’s appeal. The shared namespace would clash with Helm-managed deploys (which stamp managed-by: Helm), ArgoCD’s instance tracking, Backstage/IDP catalogs scraping it for service identity, etc. Argo Workflows itself made the same call: every Argo label lives under workflows.argoproj.io/*, with an explicit comment at workflow/common/common.go:97 calling out that their /component is “intentionally similar to app.kubernetes.io/component” but staying in their own namespace.

cargo.athena/version is the USER crate’s version (matches reader intuition - “what version of this code emitted this WT?”); athena’s own toolchain version is cargo.athena/toolchain to avoid the ambiguity from PR #57’s first cut.

Source

pub fn resolved_host_paths(&self, own: &[&str], callees: &[&str]) -> Vec<String>

hostPaths: own host!s ∪ fragment closure.

Source

pub fn resolved_in_artifacts( &self, own: &[&str], callees: &[&str], ) -> Vec<String>

Input artifact ports: own load_artifact*!s ∪ fragment closure.

Source

pub fn resolved_out_artifacts( &self, own: &[&str], callees: &[&str], ) -> Vec<String>

Output artifact ports: own save_artifact*!s ∪ fragment closure.

Source

pub fn resolved_pvc_names(&self, own: &[&str], callees: &[&str]) -> Vec<String>

PVCs referenced directly via pvc!(Type) ∪ the transitive closure through #[fragment] callees. Each entry is a PvcReg::argo_name; look up the full spec in BuildCtx::pvc (or just call Self::pvc_volumes).

Source

pub fn pvc(&self, argo_name: &str) -> Option<&'static PvcReg>

Look up a PVC’s full spec by argo name ("" if unknown — the macros only ever pass names backed by an actual Pvc impl, so None here means a wormhole link bug).

Source

pub fn pvc_volumes(&self, names: &[String]) -> (Vec<Volume>, Vec<VolumeMount>)

(volumes, volume_mounts) for a resolved PVC name list (the output of Self::resolved_pvc_names). Each name produces one Volume { persistent_volume_claim: { claim_name } } plus one matching VolumeMount at the PVC’s stable /athena/pvcs/<hash> mount path.

For an Ephemeral PVC the volume’s claim_name is the PVC’s argo name itself — Argo creates the PVC under that name via the workflow spec’s volumeClaimTemplates. For External PVCs the claim_name is the user-provided pre-existing PVC name.

Source

pub fn resolved_secrets( &self, own: &[(&str, &str, bool)], own_callees: &[&str], ) -> Vec<(String, String, bool)>

Env-var-sourced K8s secrets: own secret!/secret_opt! decls ∪ the #[fragment] closure (deduped on the (name, key) pair). Same shape as resolved, but the data are triples not strings, so this is open-coded rather than going through the generic helper. Two extra rules the string kinds don’t need:

  • Required wins. A pair declared by both secret! and secret_opt! (traversal order is non-obvious to users) emits optional: false — a missing secret then fails pod-start with a clear K8s event instead of panicking mid-body in-pod.
  • Env-name collisions fail loud. secret_env_name flattens ./-/_ alike, so distinct pairs like ("a.b", "k") and ("a-b", "k") map to one env var; emitting both would let one silently shadow the other (host mounts are immune — they key by hash). Panic at emit instead.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.