From 16ef3e7ab7cb48f84cb6bab4d0c3184fd131c3f3 Mon Sep 17 00:00:00 2001 From: Natik Gadzhi Date: Thu, 23 Nov 2023 04:28:58 -0800 Subject: [PATCH] Use full commit SHA hash for release detection (#2174) --- CHANGELOG.md | 1 + sentry-ruby/lib/sentry/release_detector.rb | 2 +- sentry-ruby/spec/sentry_spec.rb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b2d8eac6..dc228931f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Features - Improve default slug generation for Crons [#2168](https://github.com/getsentry/sentry-ruby/pull/2168) +- Change release name generator to use full SHA commit hash and align with `sentry-cli` and other Sentry SDKs [#2174](https://github.com/getsentry/sentry-ruby/pull/2174) - Automatic Crons support for scheduling gems - Add support for [`sidekiq-cron`](https://github.com/sidekiq-cron/sidekiq-cron) [#2170](https://github.com/getsentry/sentry-ruby/pull/2170) diff --git a/sentry-ruby/lib/sentry/release_detector.rb b/sentry-ruby/lib/sentry/release_detector.rb index 7b0ad9995..a975520eb 100644 --- a/sentry-ruby/lib/sentry/release_detector.rb +++ b/sentry-ruby/lib/sentry/release_detector.rb @@ -28,7 +28,7 @@ def detect_release_from_capistrano(project_root) end def detect_release_from_git - Sentry.sys_command("git rev-parse --short HEAD") if File.directory?(".git") + Sentry.sys_command("git rev-parse HEAD") if File.directory?(".git") end def detect_release_from_env diff --git a/sentry-ruby/spec/sentry_spec.rb b/sentry-ruby/spec/sentry_spec.rb index da784a6bf..b2fd37164 100644 --- a/sentry-ruby/spec/sentry_spec.rb +++ b/sentry-ruby/spec/sentry_spec.rb @@ -844,7 +844,7 @@ allow(File).to receive(:directory?).with(".git").and_return(true) end it 'gets release from git' do - allow(Sentry).to receive(:`).with("git rev-parse --short HEAD 2>&1").and_return("COMMIT_SHA") + allow(Sentry).to receive(:`).with("git rev-parse HEAD 2>&1").and_return("COMMIT_SHA") described_class.init expect(described_class.configuration.release).to eq('COMMIT_SHA')