1
1
//! Spin's client for distributing applications via OCI registries
2
2
3
- use std:: collections:: HashMap ;
3
+ use std:: collections:: { BTreeMap , HashMap } ;
4
4
use std:: path:: { Path , PathBuf } ;
5
5
6
6
use anyhow:: { bail, Context , Result } ;
@@ -103,6 +103,7 @@ impl Client {
103
103
& mut self ,
104
104
manifest_path : & Path ,
105
105
reference : impl AsRef < str > ,
106
+ annotations : Option < BTreeMap < String , String > > ,
106
107
) -> Result < Option < String > > {
107
108
let reference: Reference = reference
108
109
. as_ref ( )
@@ -121,7 +122,8 @@ impl Client {
121
122
)
122
123
. await ?;
123
124
124
- self . push_locked_core ( locked, auth, reference) . await
125
+ self . push_locked_core ( locked, auth, reference, annotations)
126
+ . await
125
127
}
126
128
127
129
/// Push a Spin application to an OCI registry and return the digest (or None
@@ -130,14 +132,16 @@ impl Client {
130
132
& mut self ,
131
133
locked : LockedApp ,
132
134
reference : impl AsRef < str > ,
135
+ annotations : Option < BTreeMap < String , String > > ,
133
136
) -> Result < Option < String > > {
134
137
let reference: Reference = reference
135
138
. as_ref ( )
136
139
. parse ( )
137
140
. with_context ( || format ! ( "cannot parse reference {}" , reference. as_ref( ) ) ) ?;
138
141
let auth = Self :: auth ( & reference) . await ?;
139
142
140
- self . push_locked_core ( locked, auth, reference) . await
143
+ self . push_locked_core ( locked, auth, reference, annotations)
144
+ . await
141
145
}
142
146
143
147
/// Push a Spin application to an OCI registry and return the digest (or None
@@ -147,6 +151,7 @@ impl Client {
147
151
locked : LockedApp ,
148
152
auth : RegistryAuth ,
149
153
reference : Reference ,
154
+ annotations : Option < BTreeMap < String , String > > ,
150
155
) -> Result < Option < String > > {
151
156
let mut locked_app = locked. clone ( ) ;
152
157
let mut layers = self
@@ -199,7 +204,7 @@ impl Client {
199
204
} ;
200
205
let oci_config =
201
206
oci_distribution:: client:: Config :: oci_v1_from_config_file ( oci_config_file, None ) ?;
202
- let manifest = OciImageManifest :: build ( & layers, & oci_config, None ) ;
207
+ let manifest = OciImageManifest :: build ( & layers, & oci_config, annotations ) ;
203
208
204
209
let response = self
205
210
. oci
0 commit comments