Skip to content

Commit b4d1fec

Browse files
authored
Add commit_id option to ServeWebArgs for specific client version (microsoft#255494)
* Add commit_id option to ServeWebArgs for specific client version * Don't start serve-web update checker if given commit-id
1 parent cd20192 commit b4d1fec

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

cli/src/commands/args.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ pub struct ServeWebArgs {
216216
/// Specifies the directory that server data is kept in.
217217
#[clap(long)]
218218
pub server_data_dir: Option<String>,
219+
/// Use a specific commit SHA for the client.
220+
#[clap(long)]
221+
pub commit_id: Option<String>,
219222
}
220223

221224
#[derive(Args, Debug, Clone)]

cli/src/commands/serve_web.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ pub async fn serve_web(ctx: CommandContext, mut args: ServeWebArgs) -> Result<i3
8888

8989
let cm: Arc<ConnectionManager> = ConnectionManager::new(&ctx, platform, args.clone());
9090
let update_check_interval = 3600;
91-
cm.clone()
92-
.start_update_checker(Duration::from_secs(update_check_interval));
91+
if args.commit_id.is_none() {
92+
cm.clone()
93+
.start_update_checker(Duration::from_secs(update_check_interval));
94+
}
9395

9496
let key = get_server_key_half(&ctx.paths);
9597
let make_svc = move || {
@@ -629,6 +631,22 @@ impl ConnectionManager {
629631
Quality::try_from(q).map_err(|_| CodeError::UpdatesNotConfigured("unknown quality"))
630632
})?;
631633

634+
if let Some(commit) = &self.args.commit_id {
635+
let release = Release {
636+
name: commit.to_string(),
637+
commit: commit.to_string(),
638+
platform: self.platform,
639+
target: target_kind,
640+
quality,
641+
};
642+
debug!(
643+
self.log,
644+
"using provided commit instead of latest release: {}", release
645+
);
646+
*latest = Some((now, release.clone()));
647+
return Ok(release);
648+
}
649+
632650
let release = self
633651
.update_service
634652
.get_latest_commit(self.platform, target_kind, quality)

0 commit comments

Comments
 (0)