From 8e2abedcdf2ca9c2ed3636e5930b83277e3c7b19 Mon Sep 17 00:00:00 2001 From: Marc Brinkmann Date: Sun, 14 Jan 2024 16:47:28 +0100 Subject: [PATCH] Fix #38 by correcting image url and order of inspect podman call --- CHANGELOG.md | 4 ++++ src/container_orchestrator.rs | 27 +++++++++++++-------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0922765..79b7a28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Log messages have been cleaned up. +### Fixed + +* Images uploaded are now properly inspected (would cause all uploads to fail before). + ## [0.1.0] - 2024-01-14 Initial release diff --git a/src/container_orchestrator.rs b/src/container_orchestrator.rs index e1b7099..e742cdf 100644 --- a/src/container_orchestrator.rs +++ b/src/container_orchestrator.rs @@ -251,20 +251,6 @@ impl ContainerOrchestrator { let production_tag = "prod"; if matches!(manifest_reference.reference(), Reference::Tag(tag) if tag == production_tag) { - let image_json_raw = self - .podman - .inspect("image", &manifest_reference.to_string()) - .await - .context("failed to fetch image information via inspect")?; - - let image_json: Vec = serde_json::from_value(image_json_raw) - .context("failed to deserialize image information")?; - let volumes = image_json - .get(0) - .context("no information via inspect")? - .config - .volume_iter(); - let location = manifest_reference.location(); let name = format!("rockslide-{}-{}", location.repository(), location.image()); @@ -306,6 +292,19 @@ impl ContainerOrchestrator { // Prepare volumes. let volume_base = manifest_reference.namespaced_dir(&self.volumes_dir); + let image_json_raw = self + .podman + .inspect("image", &image_url) + .await + .context("failed to fetch image information via inspect")?; + let image_json: Vec = serde_json::from_value(image_json_raw) + .context("failed to deserialize image information")?; + let volumes = image_json + .get(0) + .context("no information via inspect")? + .config + .volume_iter(); + let mut podman_run = self.podman.run(&image_url); for vol_desc in volumes {