Commit d2ed2685 authored by Fabio Pitino's avatar Fabio Pitino

Log more info when dropping jobs on CI minutes exceeded

parent 3c832e79
...@@ -30,10 +30,11 @@ module Ci ...@@ -30,10 +30,11 @@ module Ci
::Gitlab::AppLogger.info( ::Gitlab::AppLogger.info(
message: 'Build dropped due to CI minutes limit exceeded', message: 'Build dropped due to CI minutes limit exceeded',
namespace: root_namespace.name,
project_path: build.project.full_path, project_path: build.project.full_path,
build_id: build.id, build_id: build.id,
user_id: build.user_id user_id: build.user_id,
) username: build.user&.username)
ServiceResponse.success(message: 'Build dropped due to CI minutes limit exceeded', payload: { current_balance: new_balance }) ServiceResponse.success(message: 'Build dropped due to CI minutes limit exceeded', payload: { current_balance: new_balance })
else else
......
...@@ -5,7 +5,8 @@ require 'spec_helper' ...@@ -5,7 +5,8 @@ require 'spec_helper'
RSpec.describe Ci::Minutes::TrackLiveConsumptionService do RSpec.describe Ci::Minutes::TrackLiveConsumptionService do
let(:project) { create(:project, :private, shared_runners_enabled: true, namespace: namespace) } let(:project) { create(:project, :private, shared_runners_enabled: true, namespace: namespace) }
let(:namespace) { create(:namespace, shared_runners_minutes_limit: 100) } let(:namespace) { create(:namespace, shared_runners_minutes_limit: 100) }
let(:build) { create(:ci_build, :running, project: project, runner: runner) } let(:user) { create(:user) }
let(:build) { create(:ci_build, :running, project: project, runner: runner, user: user) }
let(:runner) { create(:ci_runner, :instance) } let(:runner) { create(:ci_runner, :instance) }
let(:service) { described_class.new(build) } let(:service) { described_class.new(build) }
...@@ -53,9 +54,11 @@ RSpec.describe Ci::Minutes::TrackLiveConsumptionService do ...@@ -53,9 +54,11 @@ RSpec.describe Ci::Minutes::TrackLiveConsumptionService do
it 'logs event' do it 'logs event' do
expect(Gitlab::AppLogger).to receive(:info).with( expect(Gitlab::AppLogger).to receive(:info).with(
message: 'Build dropped due to CI minutes limit exceeded', message: 'Build dropped due to CI minutes limit exceeded',
namespace: project.root_namespace.name,
project_path: project.full_path, project_path: project.full_path,
build_id: build.id, build_id: build.id,
user_id: build.user_id) user_id: user.id,
username: user.username)
subject subject
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