mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-20 02:08:47 +00:00
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
This commit is contained in:
@@ -216,6 +216,9 @@ pub struct ServeWebArgs {
|
|||||||
/// Specifies the directory that server data is kept in.
|
/// Specifies the directory that server data is kept in.
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
pub server_data_dir: Option<String>,
|
pub server_data_dir: Option<String>,
|
||||||
|
/// Use a specific commit SHA for the client.
|
||||||
|
#[clap(long)]
|
||||||
|
pub commit_id: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Args, Debug, Clone)]
|
#[derive(Args, Debug, Clone)]
|
||||||
|
|||||||
@@ -88,8 +88,10 @@ pub async fn serve_web(ctx: CommandContext, mut args: ServeWebArgs) -> Result<i3
|
|||||||
|
|
||||||
let cm: Arc<ConnectionManager> = ConnectionManager::new(&ctx, platform, args.clone());
|
let cm: Arc<ConnectionManager> = ConnectionManager::new(&ctx, platform, args.clone());
|
||||||
let update_check_interval = 3600;
|
let update_check_interval = 3600;
|
||||||
|
if args.commit_id.is_none() {
|
||||||
cm.clone()
|
cm.clone()
|
||||||
.start_update_checker(Duration::from_secs(update_check_interval));
|
.start_update_checker(Duration::from_secs(update_check_interval));
|
||||||
|
}
|
||||||
|
|
||||||
let key = get_server_key_half(&ctx.paths);
|
let key = get_server_key_half(&ctx.paths);
|
||||||
let make_svc = move || {
|
let make_svc = move || {
|
||||||
@@ -629,6 +631,22 @@ impl ConnectionManager {
|
|||||||
Quality::try_from(q).map_err(|_| CodeError::UpdatesNotConfigured("unknown quality"))
|
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
|
let release = self
|
||||||
.update_service
|
.update_service
|
||||||
.get_latest_commit(self.platform, target_kind, quality)
|
.get_latest_commit(self.platform, target_kind, quality)
|
||||||
|
|||||||
Reference in New Issue
Block a user