Skip to content

Commit

Permalink
Use full commit SHA hash for release detection (#2174)
Browse files Browse the repository at this point in the history
  • Loading branch information
natikgadzhi authored Nov 23, 2023
1 parent 4edfdf1 commit 16ef3e7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion sentry-ruby/lib/sentry/release_detector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sentry-ruby/spec/sentry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 16ef3e7

Please sign in to comment.