@@ -6,6 +6,7 @@ use cfsctl::composefs_boot;
66use cfsctl:: composefs_oci;
77use composefs:: fsverity:: { FsVerityHashValue , Sha512HashValue } ;
88use composefs_boot:: BootOps ;
9+ use composefs_oci:: OciDigest ;
910use composefs_oci:: image:: create_filesystem;
1011use fn_error_context:: context;
1112use ocidir:: cap_std:: ambient_authority;
@@ -59,10 +60,10 @@ pub(crate) async fn is_image_pulled(
5960 let imgref_repr = get_imgref ( & imgref. transport , & imgref. image ) ;
6061 let img_config_manifest = get_container_manifest_and_config ( & imgref_repr) . await ?;
6162
62- let img_digest = img_config_manifest. manifest . config ( ) . digest ( ) . digest ( ) ;
63+ let config_digest = img_config_manifest. manifest . config ( ) . digest ( ) ;
6364
6465 // TODO: export config_identifier function from composefs-oci/src/lib.rs and use it here
65- let img_id = format ! ( "oci-config-sha256:{img_digest }" ) ;
66+ let img_id = format ! ( "oci-config-{config_digest }" ) ;
6667
6768 // NB: add deep checking?
6869 let container_pulled = repo. has_stream ( & img_id) . context ( "Checking stream" ) ?;
@@ -132,13 +133,13 @@ pub(crate) fn validate_update(
132133 storage : & Storage ,
133134 booted_cfs : & BootedComposefs ,
134135 host : & Host ,
135- img_digest : & str ,
136+ config_digest : & OciDigest ,
136137 config_verity : & Sha512HashValue ,
137138 is_switch : bool ,
138139) -> Result < UpdateAction > {
139140 let repo = & * booted_cfs. repo ;
140141
141- let mut fs = create_filesystem ( repo, img_digest , Some ( config_verity) ) ?;
142+ let mut fs = create_filesystem ( repo, config_digest , Some ( config_verity) ) ?;
142143 fs. transform_for_boot ( & repo) ?;
143144
144145 let image_id = fs. compute_image_id ( ) ;
@@ -409,7 +410,8 @@ pub(crate) async fn upgrade_composefs(
409410 let repo = & * composefs. repo ;
410411
411412 let ( img_pulled, mut img_config) = is_image_pulled ( & repo, booted_imgref) . await ?;
412- let booted_img_digest = img_config. manifest . config ( ) . digest ( ) . digest ( ) . to_owned ( ) ;
413+ let booted_config_digest = img_config. manifest . config ( ) . digest ( ) . clone ( ) ;
414+ let booted_img_digest = booted_config_digest. to_string ( ) ;
413415
414416 // Check if we already have this update staged
415417 // Or if we have another staged deployment with a different image
@@ -441,7 +443,7 @@ pub(crate) async fn upgrade_composefs(
441443 storage,
442444 composefs,
443445 & host,
444- img_config. manifest . config ( ) . digest ( ) . digest ( ) ,
446+ img_config. manifest . config ( ) . digest ( ) ,
445447 & cfg_verity,
446448 false ,
447449 ) ?;
@@ -477,7 +479,7 @@ pub(crate) async fn upgrade_composefs(
477479 storage,
478480 composefs,
479481 & host,
480- & booted_img_digest ,
482+ & booted_config_digest ,
481483 & cfg_verity,
482484 false ,
483485 ) ?;
0 commit comments