Commit 16a50e21 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'rails-logger-cop-5' into 'master'

Use appLogger in build and ssh host key

See merge request gitlab-org/gitlab!32187
parents 2f416018 96598878
...@@ -352,7 +352,7 @@ module Ci ...@@ -352,7 +352,7 @@ module Ci
begin begin
Ci::Build.retry(build, build.user) Ci::Build.retry(build, build.user)
rescue Gitlab::Access::AccessDeniedError => ex rescue Gitlab::Access::AccessDeniedError => ex
Rails.logger.error "Unable to auto-retry job #{build.id}: #{ex}" # rubocop:disable Gitlab/RailsLogger Gitlab::AppLogger.error "Unable to auto-retry job #{build.id}: #{ex}"
end end
end end
end end
......
...@@ -107,7 +107,7 @@ class SshHostKey ...@@ -107,7 +107,7 @@ class SshHostKey
if status.success? && !errors.present? if status.success? && !errors.present?
{ known_hosts: known_hosts } { known_hosts: known_hosts }
else else
Rails.logger.debug("Failed to detect SSH host keys for #{id}: #{errors}") # rubocop:disable Gitlab/RailsLogger Gitlab::AppLogger.debug("Failed to detect SSH host keys for #{id}: #{errors}")
{ error: 'Failed to detect SSH host keys' } { error: 'Failed to detect SSH host keys' }
end end
......
---
title: Use applogger in build and ssh host key
merge_request: 32187
author: Rajendra Kadam
type: fixed
...@@ -3612,7 +3612,7 @@ describe Ci::Build do ...@@ -3612,7 +3612,7 @@ describe Ci::Build do
.to receive(:execute) .to receive(:execute)
.with(subject) .with(subject)
.and_raise(Gitlab::Access::AccessDeniedError) .and_raise(Gitlab::Access::AccessDeniedError)
allow(Rails.logger).to receive(:error) allow(Gitlab::AppLogger).to receive(:error)
end end
it 'handles raised exception' do it 'handles raised exception' do
...@@ -3622,7 +3622,7 @@ describe Ci::Build do ...@@ -3622,7 +3622,7 @@ describe Ci::Build do
it 'logs the error' do it 'logs the error' do
subject.drop! subject.drop!
expect(Rails.logger) expect(Gitlab::AppLogger)
.to have_received(:error) .to have_received(:error)
.with(a_string_matching("Unable to auto-retry job #{subject.id}")) .with(a_string_matching("Unable to auto-retry job #{subject.id}"))
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment