Skip to content

Commit

Permalink
Properly set environment in deployment tracking (#404)
Browse files Browse the repository at this point in the history
* Properly set environment in deployment tracking

Follow-up to #397

* Add proper PR reference to Changelog

* env => environment
  • Loading branch information
stmllr authored Apr 15, 2021
1 parent 2ad4201 commit d6b301b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ adheres to [Semantic Versioning](http://semver.org/).
- Added 'ActionDispatch::Http::MimeNegotiation::InvalidType' (Rails 6.1) to
default ignore list. (#402, @jrochkind)
- Replaced fixed number for retries in Sidekiq Plugin with Sidekiq::JobRetry constant
- Properly set environment in deployment tracking (#404, @stmllr)

## [4.8.0] - 2021-03-16
### Fixed
Expand Down
6 changes: 3 additions & 3 deletions lib/honeybadger/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,16 @@ def check_in(id)
# @example
# Honeybadger.track_deployment(revision: 'be2ceb6')
#
# @param [String] :env The environment name. Defaults to the current configured environment.
# @param [String] :environment The environment name. Defaults to the current configured environment.
# @param [String] :revision The VCS revision being deployed. Defaults to the currently configured revision.
# @param [String] :local_username The name of the user who performed the deploy.
# @param [String] :repository The base URL of the VCS repository. It should be HTTPS-style.
#
# @return [Boolean] true if the deployment was successfully tracked and false
# otherwise.
def track_deployment(env: nil, revision: nil, local_username: nil, repository: nil)
def track_deployment(environment: nil, revision: nil, local_username: nil, repository: nil)
opts = {
env: env || config[:env],
environment: environment || config[:env],
revision: revision || config[:revision],
local_username: local_username,
repository: repository
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/honeybadger/agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
it 'passes the revision to the servce' do
allow_any_instance_of(Honeybadger::Util::HTTP).to receive(:compress) { |_, body| body }
stub_request(:post, "https://api.honeybadger.io/v1/deploys").
with(body: { env: nil, revision: '1234', local_username: nil, repository: nil }).
with(body: { environment: nil, revision: '1234', local_username: nil, repository: nil }).
to_return(status: 200)

expect(instance.track_deployment(revision: '1234')).to eq(true)
Expand Down

0 comments on commit d6b301b

Please sign in to comment.