Skip to content

Commit

Permalink
fix(commands): Add missing env vars for release name detection (#2051)
Browse files Browse the repository at this point in the history
Check env vars SENTRY_RELEASE and GAE_DEPLOYMENT_ID when detecting release name, as done by SDKs.

Fixes GH-2050
  • Loading branch information
elramen authored May 22, 2024
1 parent 554f4fc commit 0295c36
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/utils/releases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ pub fn infer_gradle_release_name(path: Option<PathBuf>) -> Result<Option<String>

/// Detects the release name for the current working directory.
pub fn detect_release_name() -> Result<String> {
// cordova release detection first.
// try SENTRY_RELEASE environment variable
if let Ok(release) = env::var("SENTRY_RELEASE") {
if !release.is_empty() {
return Ok(release);
}
}

// try cordova release detection
if let Some(release) = get_cordova_release_name(None)? {
return Ok(release);
}
Expand Down Expand Up @@ -142,6 +149,13 @@ pub fn detect_release_name() -> Result<String> {
return Ok(release);
}

// try Google App Engine: https://cloud.google.com/appengine/docs/standard/python3/runtime#environment_variables
if let Ok(release) = env::var("GAE_DEPLOYMENT_ID") {
if !release.is_empty() {
return Ok(release);
}
}

match vcs::find_head() {
Ok(head) => Ok(head),
Err(e) => Err(anyhow!(
Expand Down

0 comments on commit 0295c36

Please sign in to comment.