@@ -7,11 +7,8 @@ use docker_credential::DockerCredential;
7
7
use futures_util:: future;
8
8
use futures_util:: stream:: { self , StreamExt , TryStreamExt } ;
9
9
use 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 ,
15
12
} ;
16
13
use reqwest:: Url ;
17
14
use spin_common:: sha256;
@@ -174,14 +171,15 @@ impl Client {
174
171
) ;
175
172
layers. push ( locked_config_layer) ;
176
173
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 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 config_file = ConfigFile {
179
+ ..Default :: default ( )
184
180
} ;
181
+ let oci_config =
182
+ oci_distribution:: client:: Config :: oci_v1_from_config_file ( config_file, None ) ?;
185
183
let manifest = OciImageManifest :: build ( & layers, & oci_config, None ) ;
186
184
187
185
let response = self
@@ -292,7 +290,6 @@ impl Client {
292
290
// Older published Spin apps feature the locked app config *as* the OCI manifest config layer,
293
291
// while newer versions publish the locked app config as a generic layer alongside others.
294
292
// 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.
296
293
let mut cfg_bytes = Vec :: new ( ) ;
297
294
self . oci
298
295
. pull_blob ( & reference, & manifest. config . digest , & mut cfg_bytes)
0 commit comments