@@ -121,12 +121,16 @@ pub struct LayeredImageState {
121
121
pub merge_commit : String ,
122
122
/// The digest of the original manifest
123
123
pub manifest_digest : Digest ,
124
- /// The image manfiest
124
+ /// The image manifest
125
125
pub manifest : ImageManifest ,
126
126
/// The image configuration
127
127
pub configuration : ImageConfiguration ,
128
128
/// Metadata for (cached, previously fetched) updates to the image, if any.
129
129
pub cached_update : Option < CachedImageUpdate > ,
130
+ /// The signature verification text from libostree for the base commit;
131
+ /// in the future we should probably instead just proxy a signature object
132
+ /// instead, but this is sufficient for now.
133
+ pub verify_text : Option < String > ,
130
134
}
131
135
132
136
impl LayeredImageState {
@@ -230,6 +234,8 @@ pub struct PreparedImport {
230
234
pub ostree_commit_layer : Option < ManifestLayerState > ,
231
235
/// Any further non-ostree (derived) layers.
232
236
pub layers : Vec < ManifestLayerState > ,
237
+ /// OSTree remote signature verification text, if enabled.
238
+ pub verify_text : Option < String > ,
233
239
}
234
240
235
241
impl PreparedImport {
@@ -635,6 +641,7 @@ impl ImageImporter {
635
641
ostree_layers : component_layers,
636
642
ostree_commit_layer : commit_layer,
637
643
layers : remaining_layers,
644
+ verify_text : None ,
638
645
} ;
639
646
Ok ( Box :: new ( imp) )
640
647
}
@@ -704,7 +711,7 @@ impl ImageImporter {
704
711
/// Extract the base ostree commit.
705
712
#[ context( "Unencapsulating base" ) ]
706
713
pub ( crate ) async fn unencapsulate_base (
707
- & mut self ,
714
+ & self ,
708
715
import : & mut store:: PreparedImport ,
709
716
require_ostree : bool ,
710
717
write_refs : bool ,
@@ -804,17 +811,19 @@ impl ImageImporter {
804
811
let blob = super :: unencapsulate:: decompressor ( & media_type, blob) ?;
805
812
let mut archive = tar:: Archive :: new ( blob) ;
806
813
importer. import_commit ( & mut archive, Some ( cancellable) ) ?;
807
- let commit = importer. finish_import_commit ( ) ;
814
+ let ( commit, verify_text ) = importer. finish_import_commit ( ) ;
808
815
if write_refs {
809
816
repo. transaction_set_ref ( None , & target_ref, Some ( commit. as_str ( ) ) ) ;
810
817
tracing:: debug!( "Wrote {} => {}" , target_ref, commit) ;
811
818
}
812
819
repo. mark_commit_partial ( & commit, false ) ?;
813
820
txn. commit ( Some ( cancellable) ) ?;
814
- Ok :: < _ , anyhow:: Error > ( commit)
821
+ Ok :: < _ , anyhow:: Error > ( ( commit, verify_text ) )
815
822
} ) ;
816
- let commit = super :: unencapsulate:: join_fetch ( import_task, driver) . await ?;
823
+ let ( commit, verify_text) =
824
+ super :: unencapsulate:: join_fetch ( import_task, driver) . await ?;
817
825
commit_layer. commit = Some ( commit) ;
826
+ import. verify_text = verify_text;
818
827
if let Some ( p) = self . layer_progress . as_ref ( ) {
819
828
p. send ( ImportProgress :: OstreeChunkCompleted (
820
829
commit_layer. layer . clone ( ) ,
@@ -977,7 +986,7 @@ impl ImageImporter {
977
986
. unwrap_or_else ( || chrono:: offset:: Utc :: now ( ) . timestamp ( ) as u64 ) ;
978
987
// Destructure to transfer ownership to thread
979
988
let repo = self . repo ;
980
- let state = crate :: tokio_util:: spawn_blocking_cancellable_flatten (
989
+ let mut state = crate :: tokio_util:: spawn_blocking_cancellable_flatten (
981
990
move |cancellable| -> Result < Box < LayeredImageState > > {
982
991
use rustix:: fd:: AsRawFd ;
983
992
@@ -1090,6 +1099,8 @@ impl ImageImporter {
1090
1099
} ,
1091
1100
)
1092
1101
. await ?;
1102
+ // We can at least avoid re-verifying the base commit.
1103
+ state. verify_text = import. verify_text ;
1093
1104
Ok ( state)
1094
1105
}
1095
1106
}
@@ -1220,6 +1231,8 @@ pub fn query_image_commit(repo: &ostree::Repo, commit: &str) -> Result<Box<Layer
1220
1231
manifest,
1221
1232
configuration,
1222
1233
cached_update,
1234
+ // we can't cross-reference with a remote here
1235
+ verify_text : None ,
1223
1236
} ) ;
1224
1237
tracing:: debug!( "Wrote merge commit {}" , state. merge_commit) ;
1225
1238
Ok ( state)
0 commit comments