Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/src/container/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,11 @@ pub(crate) fn parse_manifest_layout<'a>(
Vec<&'a Descriptor>,
)> {
let config_labels = config.config().as_ref().and_then(|c| c.labels().as_ref());
let bootable_key = *ostree::METADATA_KEY_BOOTABLE;
let bootable = config_labels.map_or(false, |l| l.contains_key(bootable_key));
if !bootable {
anyhow::bail!("Target image does not have {bootable_key} label");
}

let first_layer = manifest
.layers()
Expand Down
12 changes: 11 additions & 1 deletion lib/src/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ impl Fixture {
);
metadata.insert("ostree.container-cmd", &vec!["/usr/bin/bash"]);
metadata.insert("version", &"42.0");
metadata.insert(*ostree::METADATA_KEY_BOOTABLE, &true);
let metadata = metadata.to_variant();
let commit = self.srcrepo.write_commit_with_time(
None,
Expand Down Expand Up @@ -539,6 +540,7 @@ impl Fixture {
// Load our base commit
let rev = &self.srcrepo().require_rev(self.testref())?;
let (commit, _) = self.srcrepo.load_commit(rev)?;
let metadata = commit.child_value(0);
let root = ostree::MutableTree::from_commit(self.srcrepo(), rev)?;
// Bump the commit timestamp by one day
let ts = chrono::Utc.timestamp(ostree::commit_get_timestamp(&commit) as i64, 0);
Expand Down Expand Up @@ -568,7 +570,15 @@ impl Fixture {
let root = root.downcast_ref::<ostree::RepoFile>().unwrap();
let commit = self
.srcrepo
.write_commit_with_time(Some(rev), None, None, None, root, new_ts, cancellable)
.write_commit_with_time(
Some(rev),
None,
None,
Some(&metadata),
root,
new_ts,
cancellable,
)
.context("Writing commit")?;
self.srcrepo
.transaction_set_ref(None, self.testref(), Some(commit.as_str()));
Expand Down
1 change: 1 addition & 0 deletions lib/tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use ostree_ext::fixture::{FileDef, Fixture, CONTENTS_CHECKSUM_V0, CONTENTS_V0_LE
const EXAMPLE_TAR_LAYER: &[u8] = include_bytes!("fixtures/hlinks.tar.gz");
const TEST_REGISTRY_DEFAULT: &str = "localhost:5000";

#[track_caller]
fn assert_err_contains<T>(r: Result<T>, s: impl AsRef<str>) {
let s = s.as_ref();
let msg = format!("{:#}", r.err().expect("Expecting an error"));
Expand Down