From ca9534c91b722fdb42e50ed747270be85aed9306 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 10 Oct 2024 20:23:38 +0000 Subject: [PATCH] store: Get timestamp from config or annotation Sadly this code got forked from ostree-rs-ext, where we were doing things correctly. Add the fallback to the config. Signed-off-by: Colin Walters --- lib/src/store/ostree_container.rs | 1 + tests/booted/readonly/001-test-status.nu | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/src/store/ostree_container.rs b/lib/src/store/ostree_container.rs index bd62fb00..f39fbed3 100644 --- a/lib/src/store/ostree_container.rs +++ b/lib/src/store/ostree_container.rs @@ -51,6 +51,7 @@ fn create_imagestatus( l.get(oci_spec::image::ANNOTATION_CREATED) .map(|s| s.as_str()) }) + .or_else(|| config.created().as_deref()) .and_then(try_deserialize_timestamp); let version = ostree_container::version_for_config(config).map(ToOwned::to_owned); diff --git a/tests/booted/readonly/001-test-status.nu b/tests/booted/readonly/001-test-status.nu index fab4ce13..6c799cc2 100644 --- a/tests/booted/readonly/001-test-status.nu +++ b/tests/booted/readonly/001-test-status.nu @@ -9,4 +9,5 @@ let st = bootc status --json --format-version=0 | from json assert equal $st.apiVersion org.containers.bootc/v1 let st = bootc status --format=yaml | from yaml assert equal $st.apiVersion org.containers.bootc/v1 +assert ($st.status.booted.image.timestamp != null) tap ok