@@ -13,7 +13,7 @@ use oci_distribution::{
13
13
Reference ,
14
14
} ;
15
15
use reqwest:: Url ;
16
- use spin_app:: locked:: { ContentPath , ContentRef } ;
16
+ use spin_app:: locked:: { ContentPath , ContentRef , LockedApp } ;
17
17
use spin_loader:: cache:: Cache ;
18
18
use spin_manifest:: Application ;
19
19
use tokio:: fs;
@@ -71,8 +71,35 @@ impl Client {
71
71
// We should be able to use assets::collect instead when constructing the locked app.
72
72
let locked = spin_trigger:: locked:: build_locked_app ( app. clone ( ) , working_dir. path ( ) )
73
73
. context ( "cannot create locked app" ) ?;
74
- let mut locked = locked. clone ( ) ;
74
+ let locked = locked. clone ( ) ;
75
75
76
+ self . push_locked_core ( locked, auth, reference) . await
77
+ }
78
+
79
+ /// Push a Spin application to an OCI registry and return the digest (or None
80
+ /// if the digest cannot be determined).
81
+ pub async fn push_locked (
82
+ & mut self ,
83
+ locked : LockedApp ,
84
+ reference : impl AsRef < str > ,
85
+ ) -> Result < Option < String > > {
86
+ let reference: Reference = reference
87
+ . as_ref ( )
88
+ . parse ( )
89
+ . with_context ( || format ! ( "cannot parse reference {}" , reference. as_ref( ) ) ) ?;
90
+ let auth = Self :: auth ( & reference) . await ?;
91
+
92
+ self . push_locked_core ( locked, auth, reference) . await
93
+ }
94
+
95
+ /// Push a Spin application to an OCI registry and return the digest (or None
96
+ /// if the digest cannot be determined).
97
+ async fn push_locked_core (
98
+ & mut self ,
99
+ mut locked : LockedApp ,
100
+ auth : RegistryAuth ,
101
+ reference : Reference ,
102
+ ) -> Result < Option < String > > {
76
103
// Opt-in to omitting layers for files that have been inlined into the manifest.
77
104
// TODO: After full integration this can be turned on by default.
78
105
let skip_inlined_files = !std:: env:: var_os ( "SPIN_OCI_SKIP_INLINED_FILES" )
0 commit comments