From b4d1fec915b6c4573b6e2696a665b7ff34b1be7d Mon Sep 17 00:00:00 2001 From: Justin Wang Date: Mon, 14 Jul 2025 02:12:36 -0400 Subject: [PATCH] Add commit_id option to ServeWebArgs for specific client version (#255494) * Add commit_id option to ServeWebArgs for specific client version * Don't start serve-web update checker if given commit-id --- cli/src/commands/args.rs | 3 +++ cli/src/commands/serve_web.rs | 22 ++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/cli/src/commands/args.rs b/cli/src/commands/args.rs index 52020627ca5..52c5af6d7d4 100644 --- a/cli/src/commands/args.rs +++ b/cli/src/commands/args.rs @@ -216,6 +216,9 @@ pub struct ServeWebArgs { /// Specifies the directory that server data is kept in. #[clap(long)] pub server_data_dir: Option, + /// Use a specific commit SHA for the client. + #[clap(long)] + pub commit_id: Option, } #[derive(Args, Debug, Clone)] diff --git a/cli/src/commands/serve_web.rs b/cli/src/commands/serve_web.rs index 2ddefe13083..a8b09b82838 100644 --- a/cli/src/commands/serve_web.rs +++ b/cli/src/commands/serve_web.rs @@ -88,8 +88,10 @@ pub async fn serve_web(ctx: CommandContext, mut args: ServeWebArgs) -> Result = ConnectionManager::new(&ctx, platform, args.clone()); let update_check_interval = 3600; - cm.clone() - .start_update_checker(Duration::from_secs(update_check_interval)); + if args.commit_id.is_none() { + cm.clone() + .start_update_checker(Duration::from_secs(update_check_interval)); + } let key = get_server_key_half(&ctx.paths); let make_svc = move || { @@ -629,6 +631,22 @@ impl ConnectionManager { Quality::try_from(q).map_err(|_| CodeError::UpdatesNotConfigured("unknown quality")) })?; + if let Some(commit) = &self.args.commit_id { + let release = Release { + name: commit.to_string(), + commit: commit.to_string(), + platform: self.platform, + target: target_kind, + quality, + }; + debug!( + self.log, + "using provided commit instead of latest release: {}", release + ); + *latest = Some((now, release.clone())); + return Ok(release); + } + let release = self .update_service .get_latest_commit(self.platform, target_kind, quality)