pub struct BuildCtx { /* private fields */ }Expand description
Fragment registry snapshot, passed to container builds.
Implementations§
Source§impl BuildCtx
impl BuildCtx
Sourcepub fn collect(
krate: &str,
version: &str,
bin: &str,
version_tag: Option<&str>,
commit: Option<&str>,
dirty: Option<&str>,
) -> BuildCtx
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)).
pub fn config(&self) -> &AthenaConfig
Sourcepub fn artifact_key(&self) -> &str
pub fn artifact_key(&self) -> &str
The S3 object key of this binary’s tarball,
{crate}/<version_tag>/{bin}.tar.gz.
Sourcepub fn version_tag(&self) -> &str
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.
Sourcepub fn versioned_name(&self, base: &str) -> String
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 = "…")].
Sourcepub fn athena_labels(&self) -> BTreeMap<String, String>
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.
Sourcepub fn resolved_host_paths(&self, own: &[&str], callees: &[&str]) -> Vec<String>
pub fn resolved_host_paths(&self, own: &[&str], callees: &[&str]) -> Vec<String>
hostPaths: own host!s ∪ fragment closure.
Sourcepub fn resolved_in_artifacts(
&self,
own: &[&str],
callees: &[&str],
) -> Vec<String>
pub fn resolved_in_artifacts( &self, own: &[&str], callees: &[&str], ) -> Vec<String>
Input artifact ports: own load_artifact*!s ∪ fragment closure.
Sourcepub fn resolved_out_artifacts(
&self,
own: &[&str],
callees: &[&str],
) -> Vec<String>
pub fn resolved_out_artifacts( &self, own: &[&str], callees: &[&str], ) -> Vec<String>
Output artifact ports: own save_artifact*!s ∪ fragment closure.
Sourcepub fn resolved_pvc_names(&self, own: &[&str], callees: &[&str]) -> Vec<String>
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).
Sourcepub fn pvc(&self, argo_name: &str) -> Option<&'static PvcReg>
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).
Sourcepub fn pvc_volumes(&self, names: &[String]) -> (Vec<Volume>, Vec<VolumeMount>)
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.
Sourcepub fn resolved_secrets(
&self,
own: &[(&str, &str, bool)],
own_callees: &[&str],
) -> Vec<(String, String, bool)>
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!andsecret_opt!(traversal order is non-obvious to users) emitsoptional: 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_nameflattens./-/_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.