Skip to content

Commit 8e19d6e

Browse files
committed
store: Accept just containers.bootc for as bootable
This allows us to accept images to that don't have any metadata keys starting with `ostree`. Signed-off-by: Colin Walters <[email protected]>
1 parent 6fc79fe commit 8e19d6e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/src/container/encapsulate.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ pub const LEGACY_VERSION_LABEL: &str = "version";
2727
/// The label which indicates where the ostree layers stop, and the
2828
/// derived ones start.
2929
pub const DIFFID_LABEL: &str = "ostree.final-diffid";
30+
/// The label for bootc.
31+
pub const BOOTC_LABEL: &str = "containers.bootc";
3032

3133
/// Annotation injected into the layer to say that this is an ostree commit.
3234
/// However, because this gets lost when converted to D2S2 https://docs.docker.com/registry/spec/manifest-v2-2/
@@ -68,7 +70,7 @@ fn commit_meta_to_labels<'a>(
6870
#[allow(clippy::explicit_auto_deref)]
6971
if let Some(v) = meta.lookup::<bool>(*ostree::METADATA_KEY_BOOTABLE)? {
7072
labels.insert(ostree::METADATA_KEY_BOOTABLE.to_string(), v.to_string());
71-
labels.insert("containers.bootc".into(), "1".into());
73+
labels.insert(BOOTC_LABEL.into(), "1".into());
7274
}
7375
// Handle any other string-typed values here.
7476
for k in &[&ostree::METADATA_KEY_LINUX] {

lib/src/container/store.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,9 @@ impl ImageImporter {
584584
let config_labels = super::labels_of(&config);
585585
if self.require_bootable {
586586
let bootable_key = *ostree::METADATA_KEY_BOOTABLE;
587-
let bootable = config_labels.map_or(false, |l| l.contains_key(bootable_key));
587+
let bootable = config_labels.map_or(false, |l| {
588+
l.contains_key(bootable_key) || l.contains_key(BOOTC_LABEL)
589+
});
588590
if !bootable {
589591
anyhow::bail!("Target image does not have {bootable_key} label");
590592
}

0 commit comments

Comments
 (0)