Add build SHA to panic reports and zed --version
(on nightly/dev) (#24258)
Release Notes: - N/A
This commit is contained in:
parent
f08b1d78ec
commit
69e6910c9c
8 changed files with 76 additions and 33 deletions
|
@ -14,22 +14,17 @@ fn main() {
|
|||
std::env::var("TARGET").unwrap()
|
||||
);
|
||||
|
||||
// If we're building this for nightly, we want to set the ZED_COMMIT_SHA
|
||||
if let Some(release_channel) = std::env::var("ZED_RELEASE_CHANNEL").ok() {
|
||||
if release_channel.as_str() == "nightly" {
|
||||
// Populate git sha environment variable if git is available
|
||||
println!("cargo:rerun-if-changed=../../.git/logs/HEAD");
|
||||
if let Some(output) = Command::new("git")
|
||||
.args(["rev-parse", "HEAD"])
|
||||
.output()
|
||||
.ok()
|
||||
.filter(|output| output.status.success())
|
||||
{
|
||||
let git_sha = String::from_utf8_lossy(&output.stdout);
|
||||
let git_sha = git_sha.trim();
|
||||
// Populate git sha environment variable if git is available
|
||||
println!("cargo:rerun-if-changed=../../.git/logs/HEAD");
|
||||
if let Some(output) = Command::new("git")
|
||||
.args(["rev-parse", "HEAD"])
|
||||
.output()
|
||||
.ok()
|
||||
.filter(|output| output.status.success())
|
||||
{
|
||||
let git_sha = String::from_utf8_lossy(&output.stdout);
|
||||
let git_sha = git_sha.trim();
|
||||
|
||||
println!("cargo:rustc-env=ZED_COMMIT_SHA={git_sha}");
|
||||
}
|
||||
}
|
||||
println!("cargo:rustc-env=ZED_COMMIT_SHA={git_sha}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ fn main() {
|
|||
|
||||
#[cfg(not(windows))]
|
||||
fn main() {
|
||||
use release_channel::{ReleaseChannel, RELEASE_CHANNEL};
|
||||
use remote::proxy::ProxyLaunchError;
|
||||
use remote_server::unix::{execute_proxy, execute_run};
|
||||
|
||||
|
@ -72,12 +73,15 @@ fn main() {
|
|||
}
|
||||
},
|
||||
Some(Commands::Version) => {
|
||||
if let Some(build_sha) = option_env!("ZED_COMMIT_SHA") {
|
||||
println!("{}", build_sha);
|
||||
} else {
|
||||
println!("{}", env!("ZED_PKG_VERSION"));
|
||||
}
|
||||
|
||||
let release_channel = *RELEASE_CHANNEL;
|
||||
match release_channel {
|
||||
ReleaseChannel::Stable | ReleaseChannel::Preview => {
|
||||
println!("{}", env!("ZED_PKG_VERSION"))
|
||||
}
|
||||
ReleaseChannel::Nightly | ReleaseChannel::Dev => {
|
||||
println!("{}", env!("ZED_COMMIT_SHA"))
|
||||
}
|
||||
};
|
||||
std::process::exit(0);
|
||||
}
|
||||
None => {
|
||||
|
|
|
@ -16,7 +16,7 @@ use node_runtime::{NodeBinaryOptions, NodeRuntime};
|
|||
use paths::logs_dir;
|
||||
use project::project_settings::ProjectSettings;
|
||||
|
||||
use release_channel::AppVersion;
|
||||
use release_channel::{AppVersion, ReleaseChannel, RELEASE_CHANNEL};
|
||||
use remote::proxy::ProxyLaunchError;
|
||||
use remote::ssh_session::ChannelClient;
|
||||
use remote::{
|
||||
|
@ -149,6 +149,14 @@ fn init_panic_hook() {
|
|||
(&backtrace).join("\n")
|
||||
);
|
||||
|
||||
let release_channel = *RELEASE_CHANNEL;
|
||||
let version = match release_channel {
|
||||
ReleaseChannel::Stable | ReleaseChannel::Preview => env!("ZED_PKG_VERSION"),
|
||||
ReleaseChannel::Nightly | ReleaseChannel::Dev => {
|
||||
option_env!("ZED_COMMIT_SHA").unwrap_or("missing-zed-commit-sha")
|
||||
}
|
||||
};
|
||||
|
||||
let panic_data = telemetry_events::Panic {
|
||||
thread: thread_name.into(),
|
||||
payload: payload.clone(),
|
||||
|
@ -156,11 +164,9 @@ fn init_panic_hook() {
|
|||
file: location.file().into(),
|
||||
line: location.line(),
|
||||
}),
|
||||
app_version: format!(
|
||||
"remote-server-{}",
|
||||
option_env!("ZED_COMMIT_SHA").unwrap_or(&env!("ZED_PKG_VERSION"))
|
||||
),
|
||||
release_channel: release_channel::RELEASE_CHANNEL.display_name().into(),
|
||||
app_version: format!("remote-server-{version}"),
|
||||
app_commit_sha: option_env!("ZED_COMMIT_SHA").map(|sha| sha.into()),
|
||||
release_channel: release_channel.display_name().into(),
|
||||
target: env!("TARGET").to_owned().into(),
|
||||
os_name: telemetry::os_name(),
|
||||
os_version: Some(telemetry::os_version()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue