@@ -7,11 +7,8 @@ use docker_credential::DockerCredential;
77use futures_util:: future;
88use futures_util:: stream:: { self , StreamExt , TryStreamExt } ;
99use oci_distribution:: {
10- client:: { Config , ImageLayer } ,
11- manifest:: { OciImageManifest , OCI_IMAGE_MEDIA_TYPE } ,
12- secrets:: RegistryAuth ,
13- token_cache:: RegistryTokenType ,
14- Reference , RegistryOperation ,
10+ client:: ImageLayer , config:: ConfigFile , manifest:: OciImageManifest , secrets:: RegistryAuth ,
11+ token_cache:: RegistryTokenType , Reference , RegistryOperation ,
1512} ;
1613use reqwest:: Url ;
1714use spin_common:: sha256;
@@ -174,14 +171,15 @@ impl Client {
174171 ) ;
175172 layers. push ( locked_config_layer) ;
176173
177- let oci_config = Config {
178- // TODO: now that the locked config bytes are pushed as a layer, what should data here be?
179- // Keeping as locked config bytes would make it feasible for older Spin clients to pull/run
180- // apps published by newer Spin clients
181- data : serde_json:: to_vec ( & locked) ?,
182- media_type : OCI_IMAGE_MEDIA_TYPE . to_string ( ) ,
183- annotations : None ,
174+ // Construct empty/default OCI config file. Data may be parsed according to
175+ // the expected config structure per the image spec, so we want to ensure it conforms.
176+ // (See https://github.com/opencontainers/image-spec/blob/main/config.md)
177+ // TODO: Explore adding data applicable to a Spin app.
178+ let oci_config_file = ConfigFile {
179+ ..Default :: default ( )
184180 } ;
181+ let oci_config =
182+ oci_distribution:: client:: Config :: oci_v1_from_config_file ( oci_config_file, None ) ?;
185183 let manifest = OciImageManifest :: build ( & layers, & oci_config, None ) ;
186184
187185 let response = self
@@ -292,7 +290,6 @@ impl Client {
292290 // Older published Spin apps feature the locked app config *as* the OCI manifest config layer,
293291 // while newer versions publish the locked app config as a generic layer alongside others.
294292 // Assume that these bytes may represent the locked app config and write it as such.
295- // TODO: update this assumption if we change the data we write to the OCI manifest config layer.
296293 let mut cfg_bytes = Vec :: new ( ) ;
297294 self . oci
298295 . pull_blob ( & reference, & manifest. config . digest , & mut cfg_bytes)
0 commit comments