feat(orchestrator): complete container migration and release hardening
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user