feat(orchestrator): complete container migration and release hardening

This commit is contained in:
archipelago
2026-04-28 15:00:58 -04:00
parent 4d05705315
commit 8f83b37d51
94 changed files with 5034 additions and 1003 deletions
@@ -217,6 +217,12 @@ mod tests {
image_signature: None,
pull_policy: "if-not-present".to_string(),
build: None,
network: None,
custom_args: vec![],
entrypoint: None,
derived_env: vec![],
secret_env: vec![],
data_uid: None,
},
dependencies: deps,
resources: Default::default(),
+3 -2
View File
@@ -10,8 +10,9 @@ pub use bitcoin_simulator::{BitcoinSimulationMode, BitcoinSimulator};
pub use dependency_resolver::DependencyResolver;
pub use health_monitor::HealthMonitor;
pub use manifest::{
AppManifest, BuildConfig, Dependency, HealthCheck, ResolvedSource, ResourceLimits,
SecurityPolicy,
AppManifest, BuildConfig, ContainerConfig, Dependency, DerivedEnv, HealthCheck, HostFacts,
ManifestError, ResolvedSource, ResourceLimits, SecretEnv, SecretsProvider, SecurityPolicy,
Volume,
};
pub use podman_client::{ContainerState, ContainerStatus, PodmanClient};
pub use port_manager::{PortError, PortManager};
+600
View File
@@ -67,6 +67,82 @@ pub struct ContainerConfig {
/// Local build source. Mutually exclusive with `image`.
#[serde(default)]
pub build: Option<BuildConfig>,
// ── Step 8b.0 additions ──────────────────────────────────────────
//
// Fields the Rust orchestrator needs to faithfully port containers
// from the legacy `scripts/container-specs.sh` registry. See
// `docs/STEP-8B-PORT-AUDIT.md` for the full justification per field.
//
// All are optional with `#[serde(default)]` so every existing manifest
// in `apps/` continues to parse unchanged.
/// Podman `--network` value. `Some("archy-net")` joins the shared
/// Archipelago bridge. `Some("host")` uses host networking.
/// `None` (the default) falls back to podman's default isolated
/// network — equivalent to today's rootless default.
///
/// `SecurityPolicy::network_policy` remains a policy knob (what the
/// firewall layer does); this field is literally the CLI flag value.
#[serde(default)]
pub network: Option<String>,
/// Extra positional arguments appended to the container command
/// after the image. Mirrors `SPEC_CUSTOM_ARGS` in
/// `scripts/container-specs.sh` (bitcoin-knots prune/dbcache flags,
/// filebrowser `--config /data/.filebrowser.json`, etc).
#[serde(default)]
pub custom_args: Vec<String>,
/// Entrypoint override (`podman run --entrypoint …`). When present,
/// replaces the image's default entrypoint. Mirrors `SPEC_ENTRYPOINT`
/// for fedimint-gateway's LND-aware invocation.
#[serde(default)]
pub entrypoint: Option<Vec<String>>,
/// Environment keys whose values are rendered from a small
/// allow-list of host facts (`HOST_IP`, `HOST_MDNS`, `DISK_GB`).
/// Resolved by `ContainerConfig::resolve_derived_env` at apply time
/// — never hard-coded into the manifest.
///
/// Example: `- { key: FM_P2P_URL, template: "fedimint://{{HOST_MDNS}}:8173" }`
#[serde(default)]
pub derived_env: Vec<DerivedEnv>,
/// Environment keys whose values are read from files in
/// `/var/lib/archipelago/secrets/<secret_file>`. Never logged.
/// Resolved by `ContainerConfig::resolve_secret_env` at apply time.
///
/// Example: `- { key: FM_BITCOIND_PASSWORD, secret_file: bitcoin-rpc-password }`
#[serde(default)]
pub secret_env: Vec<SecretEnv>,
/// Rootless-mapped UID:GID applied to the container's data directory
/// (the `bind`-mounted host path with `target` inside the container's
/// data root) before creation. Mirrors `SPEC_DATA_UID`.
///
/// Example: `"100070:100070"` for Postgres' mapped subuid.
#[serde(default)]
pub data_uid: Option<String>,
}
/// Derived-env entry. The template is rendered against `HostFacts` at
/// apply time; exactly one `{{PLACEHOLDER}}` occurrence per supported
/// fact name is allowed (host_ip, host_mdns, disk_gb).
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct DerivedEnv {
pub key: String,
pub template: String,
}
/// Secret-env entry. `secret_file` is resolved against a
/// `SecretsProvider` (in prod, `/var/lib/archipelago/secrets/`).
///
/// `secret_file` is restricted to a bare filename — no `/`, no `..`.
/// Validated at `AppManifest::validate` time.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct SecretEnv {
pub key: String,
pub secret_file: String,
}
fn default_pull_policy() -> String {
@@ -176,10 +252,15 @@ impl From<(u16, u16)> for PortMapping {
pub struct Volume {
#[serde(rename = "type")]
pub volume_type: String,
#[serde(default)]
pub source: String,
pub target: String,
#[serde(default)]
pub options: Vec<String>,
/// For `type: tmpfs` only. Comma-separated mount options
/// (e.g. `"rw,noexec,nosuid,size=256m"`). Ignored for bind/volume.
#[serde(default)]
pub tmpfs_options: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -261,10 +342,222 @@ impl AppManifest {
));
}
// ── Step 8b.0 field validation ────────────────────────────────
// network: allow any non-empty string; podman itself is the
// final authority (named networks, "host", "bridge", "none",
// "container:<name>", etc). Reject only the empty-string case
// so "network:" with no value is a loud error instead of a
// silent default.
if let Some(n) = &self.app.container.network {
if n.is_empty() {
return Err(ManifestError::Invalid(
"container.network cannot be empty (omit the field to use default)".to_string(),
));
}
}
// custom_args: no empty strings (would inject literal "" into
// the podman command line and confuse downstream parsing).
for (i, a) in self.app.container.custom_args.iter().enumerate() {
if a.is_empty() {
return Err(ManifestError::Invalid(format!(
"container.custom_args[{i}] cannot be empty"
)));
}
}
// entrypoint: present ⇒ non-empty vec, no empty elements.
if let Some(ep) = &self.app.container.entrypoint {
if ep.is_empty() {
return Err(ManifestError::Invalid(
"container.entrypoint must contain at least one element when set".to_string(),
));
}
for (i, a) in ep.iter().enumerate() {
if a.is_empty() {
return Err(ManifestError::Invalid(format!(
"container.entrypoint[{i}] cannot be empty"
)));
}
}
}
// derived_env: non-empty keys, unique keys, templates reference
// only known host-fact placeholders.
{
let mut seen: std::collections::HashSet<&str> = std::collections::HashSet::new();
for (i, e) in self.app.container.derived_env.iter().enumerate() {
if e.key.is_empty() {
return Err(ManifestError::Invalid(format!(
"container.derived_env[{i}].key cannot be empty"
)));
}
if !seen.insert(e.key.as_str()) {
return Err(ManifestError::Invalid(format!(
"container.derived_env has duplicate key '{}'",
e.key
)));
}
validate_derived_template(&e.key, &e.template)?;
}
}
// secret_env: non-empty keys, unique keys, secret_file is a
// bare filename (no '/', no '..').
{
let mut seen: std::collections::HashSet<&str> = std::collections::HashSet::new();
for (i, e) in self.app.container.secret_env.iter().enumerate() {
if e.key.is_empty() {
return Err(ManifestError::Invalid(format!(
"container.secret_env[{i}].key cannot be empty"
)));
}
if !seen.insert(e.key.as_str()) {
return Err(ManifestError::Invalid(format!(
"container.secret_env has duplicate key '{}'",
e.key
)));
}
if e.secret_file.is_empty()
|| e.secret_file.contains('/')
|| e.secret_file.contains("..")
{
return Err(ManifestError::Invalid(format!(
"container.secret_env[{}].secret_file must be a bare filename (no '/', no '..'), got '{}'",
i, e.secret_file
)));
}
}
}
// data_uid: if set, must look like "NNNNN:NNNNN".
if let Some(u) = &self.app.container.data_uid {
let parts: Vec<&str> = u.split(':').collect();
let valid = parts.len() == 2
&& !parts[0].is_empty()
&& !parts[1].is_empty()
&& parts[0].chars().all(|c| c.is_ascii_digit())
&& parts[1].chars().all(|c| c.is_ascii_digit());
if !valid {
return Err(ManifestError::Invalid(format!(
"container.data_uid must be 'UID:GID' with numeric parts, got '{}'",
u
)));
}
}
// Volume tmpfs_options: only meaningful for type: tmpfs.
for (i, v) in self.app.volumes.iter().enumerate() {
if v.volume_type == "tmpfs" {
if v.target.is_empty() {
return Err(ManifestError::Invalid(format!(
"volumes[{i}] (tmpfs) must set target"
)));
}
if !v.source.is_empty() {
return Err(ManifestError::Invalid(format!(
"volumes[{i}] (tmpfs) must not set source"
)));
}
} else if v.tmpfs_options.is_some() {
return Err(ManifestError::Invalid(format!(
"volumes[{i}] sets tmpfs_options but type is '{}', not 'tmpfs'",
v.volume_type
)));
} else {
if v.source.is_empty() {
return Err(ManifestError::Invalid(format!(
"volumes[{i}] ({}) must set source",
v.volume_type
)));
}
if v.target.is_empty() {
return Err(ManifestError::Invalid(format!(
"volumes[{i}] ({}) must set target",
v.volume_type
)));
}
}
}
Ok(())
}
}
/// Host facts available to `derived_env` templates at apply time.
///
/// Mirrors the values `scripts/container-specs.sh:detect_environment()`
/// computed before each reconcile pass. The Rust orchestrator computes
/// these once per reconcile tick and passes them to
/// `ContainerConfig::resolve_derived_env`.
#[derive(Debug, Clone)]
pub struct HostFacts {
/// Primary host IPv4 (e.g. from `hostname -I | awk '{print $1}'`).
/// Falls back to `127.0.0.1` on detection failure.
pub host_ip: String,
/// mDNS hostname (`<hostname>.local`). Survives DHCP churn and
/// reinstall-on-different-IP. Requires avahi-daemon on the node.
pub host_mdns: String,
/// Usable disk size in gigabytes at `/var/lib/archipelago` (or
/// `/` if the data partition is not yet mounted). Drives the
/// prune-vs-full-node decision in bitcoin-knots custom_args.
pub disk_gb: u64,
}
impl HostFacts {
/// Test-only constant fixture; do not use in production paths.
#[cfg(test)]
pub fn sample() -> Self {
Self {
host_ip: "192.168.1.116".to_string(),
host_mdns: "archi-thinkpad.local".to_string(),
disk_gb: 2000,
}
}
}
/// Supported placeholder names in `DerivedEnv::template`. Keep in sync
/// with `HostFacts`. Centralized so validation and rendering agree.
const DERIVED_PLACEHOLDERS: &[&str] = &["HOST_IP", "HOST_MDNS", "DISK_GB"];
fn validate_derived_template(key: &str, template: &str) -> Result<(), ManifestError> {
// Walk `{{NAME}}` occurrences and ensure each NAME is recognized.
// Unbalanced braces are a user error.
let bytes = template.as_bytes();
let mut i = 0;
while i + 1 < bytes.len() {
if bytes[i] == b'{' && bytes[i + 1] == b'{' {
let rest = &template[i + 2..];
let close = rest.find("}}").ok_or_else(|| {
ManifestError::Invalid(format!(
"container.derived_env['{key}'].template has unbalanced '{{{{' — no closing '}}}}'"
))
})?;
let name = &rest[..close];
if !DERIVED_PLACEHOLDERS.contains(&name) {
return Err(ManifestError::Invalid(format!(
"container.derived_env['{key}'].template references unknown placeholder '{{{{{name}}}}}' (supported: {})",
DERIVED_PLACEHOLDERS.join(", ")
)));
}
i = i + 2 + close + 2;
} else {
i += 1;
}
}
Ok(())
}
/// A source of named secrets. In prod this is a directory on disk
/// (`/var/lib/archipelago/secrets/`); in tests, a HashMap.
pub trait SecretsProvider {
/// Read the named secret and return its value with trailing
/// whitespace trimmed (so `echo "…" > secret-file` works without
/// injecting a newline into env).
fn read(&self, name: &str) -> Result<String, ManifestError>;
}
impl ContainerConfig {
/// Collapse the (image, build) pair into a single resolved source.
///
@@ -294,11 +587,50 @@ impl ContainerConfig {
ResolvedSource::Build(b) => b.tag,
})
}
/// Render every `derived_env` entry's template against the given
/// host facts. Returns `"KEY=VALUE"` strings ready to concatenate
/// with `environment:`.
///
/// Assumes `AppManifest::validate()` has already accepted the
/// manifest — placeholder names are not re-checked here.
pub fn resolve_derived_env(&self, facts: &HostFacts) -> Vec<String> {
self.derived_env
.iter()
.map(|e| {
let value = e
.template
.replace("{{HOST_IP}}", &facts.host_ip)
.replace("{{HOST_MDNS}}", &facts.host_mdns)
.replace("{{DISK_GB}}", &facts.disk_gb.to_string());
format!("{}={}", e.key, value)
})
.collect()
}
/// Read every `secret_env` entry's value from the provider and
/// return `"KEY=VALUE"` strings. Propagates the provider error on
/// the first missing/unreadable secret — partial resolution is not
/// useful because it silently produces a misconfigured container.
pub fn resolve_secret_env(
&self,
provider: &dyn SecretsProvider,
) -> Result<Vec<String>, ManifestError> {
let mut out = Vec::with_capacity(self.secret_env.len());
for e in &self.secret_env {
let v = provider.read(&e.secret_file)?;
out.push(format!("{}={}", e.key, v));
}
Ok(out)
}
}
#[cfg(test)]
mod tests {
use super::*;
use std::collections::HashMap;
use std::fs;
use std::path::{Path, PathBuf};
#[test]
fn test_manifest_parse() {
@@ -523,4 +855,272 @@ app:
ResolvedSource::Pull { .. }
);
}
#[test]
fn empty_custom_arg_is_rejected() {
let yaml = r#"
app:
id: x
name: X
version: 1.0.0
container:
image: foo:latest
custom_args: [""]
"#;
let err = AppManifest::parse(yaml).unwrap_err();
let msg = format!("{err}");
assert!(msg.contains("custom_args[0]"), "unexpected error: {msg}");
}
#[test]
fn empty_entrypoint_vec_is_rejected() {
let yaml = r#"
app:
id: x
name: X
version: 1.0.0
container:
image: foo:latest
entrypoint: []
"#;
let err = AppManifest::parse(yaml).unwrap_err();
let msg = format!("{err}");
assert!(msg.contains("entrypoint"), "unexpected error: {msg}");
}
#[test]
fn empty_entrypoint_element_is_rejected() {
let yaml = r#"
app:
id: x
name: X
version: 1.0.0
container:
image: foo:latest
entrypoint: ["gatewayd", ""]
"#;
let err = AppManifest::parse(yaml).unwrap_err();
let msg = format!("{err}");
assert!(msg.contains("entrypoint[1]"), "unexpected error: {msg}");
}
#[test]
fn duplicate_derived_env_keys_are_rejected() {
let yaml = r#"
app:
id: fedimint
name: Fedimint
version: 0.10.0
container:
image: fedimintd:v0.10.0
derived_env:
- key: FM_API_URL
template: "ws://{{HOST_MDNS}}:8174"
- key: FM_API_URL
template: "ws://{{HOST_IP}}:8174"
"#;
let err = AppManifest::parse(yaml).unwrap_err();
let msg = format!("{err}");
assert!(msg.contains("duplicate key"), "unexpected error: {msg}");
}
#[test]
fn unknown_derived_placeholder_is_rejected() {
let yaml = r#"
app:
id: fedimint
name: Fedimint
version: 0.10.0
container:
image: fedimintd:v0.10.0
derived_env:
- key: FM_API_URL
template: "ws://{{HOSTNAME}}:8174"
"#;
let err = AppManifest::parse(yaml).unwrap_err();
let msg = format!("{err}");
assert!(
msg.contains("unknown placeholder"),
"unexpected error: {msg}"
);
}
#[test]
fn path_traversal_secret_file_is_rejected() {
let yaml = r#"
app:
id: fedimint
name: Fedimint
version: 0.10.0
container:
image: fedimintd:v0.10.0
secret_env:
- key: FM_BITCOIND_PASSWORD
secret_file: "../bitcoin-rpc-password"
"#;
let err = AppManifest::parse(yaml).unwrap_err();
let msg = format!("{err}");
assert!(msg.contains("bare filename"), "unexpected error: {msg}");
}
#[test]
fn resolve_derived_env_renders_host_facts() {
let c = ContainerConfig {
image: Some("x:latest".to_string()),
image_signature: None,
pull_policy: "if-not-present".to_string(),
build: None,
network: None,
custom_args: vec![],
entrypoint: None,
derived_env: vec![
DerivedEnv {
key: "FM_API_URL".to_string(),
template: "ws://{{HOST_MDNS}}:8174".to_string(),
},
DerivedEnv {
key: "INFO".to_string(),
template: "{{HOST_IP}}-{{DISK_GB}}".to_string(),
},
],
secret_env: vec![],
data_uid: None,
};
let facts = HostFacts {
host_ip: "192.168.1.116".to_string(),
host_mdns: "archi-thinkpad.local".to_string(),
disk_gb: 2000,
};
let out = c.resolve_derived_env(&facts);
assert_eq!(out[0], "FM_API_URL=ws://archi-thinkpad.local:8174");
assert_eq!(out[1], "INFO=192.168.1.116-2000");
}
struct MapSecretsProvider {
data: HashMap<String, String>,
}
impl SecretsProvider for MapSecretsProvider {
fn read(&self, name: &str) -> Result<String, ManifestError> {
self.data
.get(name)
.cloned()
.ok_or_else(|| ManifestError::Invalid(format!("missing secret: {name}")))
}
}
#[test]
fn resolve_secret_env_reads_from_provider() {
let c = ContainerConfig {
image: Some("x:latest".to_string()),
image_signature: None,
pull_policy: "if-not-present".to_string(),
build: None,
network: None,
custom_args: vec![],
entrypoint: None,
derived_env: vec![],
secret_env: vec![
SecretEnv {
key: "FM_BITCOIND_PASSWORD".to_string(),
secret_file: "bitcoin-rpc-password".to_string(),
},
SecretEnv {
key: "FM_GATEWAY_PASSWORD".to_string(),
secret_file: "fedimint-gateway-password".to_string(),
},
],
data_uid: None,
};
let p = MapSecretsProvider {
data: HashMap::from([
(
"bitcoin-rpc-password".to_string(),
"supersecret1".to_string(),
),
(
"fedimint-gateway-password".to_string(),
"supersecret2".to_string(),
),
]),
};
let out = c.resolve_secret_env(&p).unwrap();
assert_eq!(out[0], "FM_BITCOIND_PASSWORD=supersecret1");
assert_eq!(out[1], "FM_GATEWAY_PASSWORD=supersecret2");
}
#[test]
fn parse_every_real_manifest() {
let app_manifests = list_repo_manifests();
assert!(
!app_manifests.is_empty(),
"no apps/*/manifest.yml files found"
);
let mut failures: Vec<String> = Vec::new();
let mut modern_count = 0usize;
let mut legacy_count = 0usize;
for path in app_manifests {
let content = fs::read_to_string(&path).expect("read manifest");
let parsed_yaml: serde_yaml::Value = match serde_yaml::from_str(&content) {
Ok(v) => v,
Err(err) => {
failures.push(format!("{}: YAML parse error: {err}", path.display()));
continue;
}
};
let is_modern = parsed_yaml
.as_mapping()
.map(|m| m.contains_key(serde_yaml::Value::String("app".to_string())))
.unwrap_or(false);
if is_modern {
modern_count += 1;
if let Err(err) = AppManifest::parse(&content) {
failures.push(format!("{}: {err}", path.display()));
}
} else {
legacy_count += 1;
}
}
assert!(modern_count > 0, "no modern app-schema manifests found");
assert!(
legacy_count > 0,
"expected at least one legacy manifest shape"
);
assert!(
failures.is_empty(),
"manifest parse failures:\n{}",
failures.join("\n")
);
}
fn list_repo_manifests() -> Vec<PathBuf> {
let repo_root = Path::new(env!("CARGO_MANIFEST_DIR")).join("..").join("..");
let apps_dir = repo_root.join("apps");
let mut out = Vec::new();
let Ok(entries) = fs::read_dir(apps_dir) else {
return out;
};
for entry in entries.flatten() {
let path = entry.path();
if !path.is_dir() {
continue;
}
let manifest = path.join("manifest.yml");
if manifest.exists() {
out.push(manifest);
}
}
out.sort();
out
}
}
+40 -11
View File
@@ -126,7 +126,7 @@ impl PodmanClient {
"filebrowser" => "http://localhost:8083",
"nginx-proxy-manager" => "http://localhost:81",
"portainer" => "http://localhost:9000",
"uptime-kuma" => "http://localhost:3001",
"uptime-kuma" => "http://localhost:3002",
"fedimint" | "fedimintd" => "http://localhost:8175",
"fedimint-gateway" => "http://localhost:8176",
"nostr-rs-relay" => "http://localhost:18081",
@@ -288,12 +288,29 @@ impl PodmanClient {
let mut mounts = Vec::new();
for volume in &manifest.app.volumes {
mounts.push(serde_json::json!({
"destination": volume.target,
"source": volume.source,
"type": "bind",
"options": volume.options,
}));
if volume.volume_type == "tmpfs" {
let options: Vec<String> = volume
.tmpfs_options
.as_deref()
.unwrap_or("")
.split(',')
.map(str::trim)
.filter(|s| !s.is_empty())
.map(|s| s.to_string())
.collect();
mounts.push(serde_json::json!({
"destination": volume.target,
"type": "tmpfs",
"options": options,
}));
} else {
mounts.push(serde_json::json!({
"destination": volume.target,
"source": volume.source,
"type": "bind",
"options": volume.options,
}));
}
}
let mut env_map = serde_json::Map::new();
@@ -340,12 +357,27 @@ impl PodmanClient {
);
}
let net_mode = if let Some(n) = manifest.app.container.network.as_ref() {
if n.is_empty() {
"bridge"
} else {
n.as_str()
}
} else {
match manifest.app.security.network_policy.as_str() {
"host" => "host",
_ => "bridge",
}
};
let body = serde_json::json!({
"name": name,
"image": image_ref,
"portmappings": port_mappings,
"mounts": mounts,
"env": env_map,
"entrypoint": manifest.app.container.entrypoint.clone(),
"command": manifest.app.container.custom_args.clone(),
"hostadd": ["host.containers.internal:host-gateway"],
"devices": manifest.app.devices.iter().map(|d| {
serde_json::json!({"path": d})
@@ -358,10 +390,7 @@ impl PodmanClient {
"restart_policy": "unless-stopped",
"restart_tries": 5,
"netns": {
"nsmode": match manifest.app.security.network_policy.as_str() {
"host" => "host",
_ => "bridge",
}
"nsmode": net_mode
},
});
+22 -5
View File
@@ -136,7 +136,11 @@ impl ContainerRuntime for PodmanRuntime {
return Err(anyhow::anyhow!(
"podman build -t {} failed: {stderr}{}{stdout}",
config.tag,
if stderr.is_empty() || stdout.is_empty() { "" } else { "\n---stdout---\n" }
if stderr.is_empty() || stdout.is_empty() {
""
} else {
"\n---stdout---\n"
}
));
}
Ok(())
@@ -441,7 +445,10 @@ impl ContainerRuntime for DockerRuntime {
// to stderr in that case is informational; we swallow it.
let mut cmd = self.docker_async();
cmd.arg("image").arg("inspect").arg(image_ref);
let output = cmd.output().await.context("failed to execute docker image inspect")?;
let output = cmd
.output()
.await
.context("failed to execute docker image inspect")?;
match output.status.code() {
Some(0) => Ok(true),
Some(1) => Ok(false),
@@ -459,15 +466,25 @@ impl ContainerRuntime for DockerRuntime {
async fn build_image(&self, config: &BuildConfig) -> Result<()> {
let mut cmd = self.docker_async();
cmd.arg("build").arg("-t").arg(&config.tag).arg("-f").arg(&config.dockerfile);
cmd.arg("build")
.arg("-t")
.arg(&config.tag)
.arg("-f")
.arg(&config.dockerfile);
for (k, v) in &config.build_args {
cmd.arg("--build-arg").arg(format!("{k}={v}"));
}
cmd.arg(&config.context);
let output = cmd.output().await.context("failed to execute docker build")?;
let output = cmd
.output()
.await
.context("failed to execute docker build")?;
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
return Err(anyhow::anyhow!("docker build -t {} failed: {stderr}", config.tag));
return Err(anyhow::anyhow!(
"docker build -t {} failed: {stderr}",
config.tag
));
}
Ok(())
}