Skip to content

Commit

Permalink
Merge pull request #280 from cgwalters/no-diffid
Browse files Browse the repository at this point in the history
Fix pulling format 0 layered images
  • Loading branch information
cgwalters authored Apr 19, 2022
2 parents a1bd69b + e69225e commit 1de5ced
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions lib/src/container/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,22 +329,14 @@ impl ImageImporter {

let label = crate::container::OSTREE_DIFFID_LABEL;
let config_labels = config.config().as_ref().and_then(|c| c.labels().as_ref());
let diffid = config_labels.and_then(|labels| labels.get(label));
// For backwards compatibility, if there's only 1 layer, don't require the label.
// This can be dropped when we drop format version 0 support.
let commit_layer_digest = if config.rootfs().diff_ids().len() == 1 {
manifest.layers()[0].digest()
} else {
let diffid = config_labels
.and_then(|labels| labels.get(label))
.ok_or_else(|| {
anyhow!(
"Missing annotation {} (not an ostree-exported container?)",
label
)
})?;

let commit_layer_digest = if let Some(diffid) = diffid {
let layer = layer_from_diffid(&manifest, &config, diffid.as_str())?;
layer.digest()
} else {
manifest.layers()[0].digest()
};
let mut component_layers = Vec::new();
let mut commit_layer = None;
Expand Down

0 comments on commit 1de5ced

Please sign in to comment.