ssh remoting: Use matching versions of remote server binary (#19740)

This changes the download logic to not fetch the latest version, but to
fetch the version matching the current version of Zed.


Release Notes:

- Changed the update logic of the SSH remote server to not fetch the
latest version for a current channel, but to fetch the version matching
the current Zed version. If Zed is updated, the server is updated too.
If the server is newer than the Zed version an error will be displayed.
This commit is contained in:
Thorsten Ball 2024-10-25 16:27:36 +02:00 committed by GitHub
parent 5769065f27
commit 5c2238c7a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 105 additions and 61 deletions

View file

@ -1707,21 +1707,32 @@ impl SshRemoteConnection {
let (binary, version) = delegate.get_server_binary(platform, cx).await??;
let mut server_binary_exists = false;
if !server_binary_exists && cfg!(not(debug_assertions)) {
let mut remote_version = None;
if cfg!(not(debug_assertions)) {
if let Ok(installed_version) =
run_cmd(self.socket.ssh_command(dst_path).arg("version")).await
{
if installed_version.trim() == version.to_string() {
server_binary_exists = true;
if let Ok(version) = installed_version.trim().parse::<SemanticVersion>() {
remote_version = Some(version);
} else {
log::warn!("failed to parse version of remote server: {installed_version:?}",);
}
log::info!("checked remote server binary for version. latest version: {}. remote server version: {}", version.to_string(), installed_version.trim());
}
}
if server_binary_exists {
log::info!("remote development server already present",);
return Ok(());
if let Some(remote_version) = remote_version {
if remote_version == version {
log::info!("remote development server present and matching client version");
return Ok(());
} else if remote_version > version {
let error = anyhow!("The version of the remote server ({}) is newer than the Zed version ({}). Please update Zed.", remote_version, version);
return Err(error);
} else {
log::info!(
"remote development server has older version: {}. updating...",
remote_version
);
}
}
}
match binary {