@@ -169,18 +169,18 @@ impl DeployCommand {
169
169
// TODO: this process involves many calls to Hippo. Should be able to update the channel
170
170
// via only `add_revision` if bindle naming schema is updated so bindles can be deterministically ordered by Hippo.
171
171
let channel_id = match self . get_app_id ( & hippo_client, name. clone ( ) ) . await {
172
- Ok ( _ ) => {
172
+ Ok ( app_id ) => {
173
173
Client :: add_revision (
174
174
& hippo_client,
175
175
name. clone ( ) ,
176
176
bindle_id. version_string ( ) . clone ( ) ,
177
177
)
178
178
. await ?;
179
179
let existing_channel_id = self
180
- . get_channel_id ( & hippo_client, SPIN_DEPLOY_CHANNEL_NAME . to_string ( ) )
180
+ . get_channel_id ( & hippo_client, SPIN_DEPLOY_CHANNEL_NAME . to_string ( ) , app_id )
181
181
. await ?;
182
182
let active_revision_id = self
183
- . get_revision_id ( & hippo_client, bindle_id. version_string ( ) . clone ( ) )
183
+ . get_revision_id ( & hippo_client, bindle_id. version_string ( ) . clone ( ) , app_id )
184
184
. await ?;
185
185
Client :: patch_channel (
186
186
& hippo_client,
@@ -292,23 +292,42 @@ impl DeployCommand {
292
292
}
293
293
}
294
294
295
- async fn get_revision_id ( & self , hippo_client : & Client , bindle_version : String ) -> Result < Uuid > {
295
+ async fn get_revision_id (
296
+ & self ,
297
+ hippo_client : & Client ,
298
+ bindle_version : String ,
299
+ app_id : Uuid ,
300
+ ) -> Result < Uuid > {
296
301
let revisions = Client :: list_revisions ( hippo_client) . await ?;
297
302
let revision = revisions
298
303
. items
299
304
. iter ( )
300
- . find ( |& x| x. revision_number == bindle_version) ;
305
+ . find ( |& x| x. revision_number == bindle_version && x . app_id == app_id ) ;
301
306
Ok ( revision
302
- . ok_or_else ( || anyhow:: anyhow!( "No revision with version {}" , bindle_version) ) ?
307
+ . ok_or_else ( || {
308
+ anyhow:: anyhow!(
309
+ "No revision with version {} and app id {}" ,
310
+ bindle_version,
311
+ app_id
312
+ )
313
+ } ) ?
303
314
. id )
304
315
}
305
316
306
- async fn get_channel_id ( & self , hippo_client : & Client , name : String ) -> Result < Uuid > {
317
+ async fn get_channel_id (
318
+ & self ,
319
+ hippo_client : & Client ,
320
+ name : String ,
321
+ app_id : Uuid ,
322
+ ) -> Result < Uuid > {
307
323
let channels_vm = Client :: list_channels ( hippo_client) . await ?;
308
- let channel = channels_vm. items . iter ( ) . find ( |& x| x. name == name. clone ( ) ) ;
324
+ let channel = channels_vm
325
+ . items
326
+ . iter ( )
327
+ . find ( |& x| x. app_id == app_id && x. name == name. clone ( ) ) ;
309
328
match channel {
310
329
Some ( c) => Ok ( c. id ) ,
311
- None => anyhow:: bail!( "No channel with name: {}" , name) ,
330
+ None => anyhow:: bail!( "No channel with app_id {} and name {}" , app_id , name) ,
312
331
}
313
332
}
314
333
0 commit comments