Commit 4099796d authored by Dmitry Gruzd's avatar Dmitry Gruzd

Merge branch 'remove-ff-ci-always-track-shared-runners-usage' into 'master'

Remove feature flag ci_always_track_shared_runners_usage

See merge request gitlab-org/gitlab!73933
parents 1fedd4af 2d79fae1
......@@ -6,7 +6,6 @@ module Ci
# Calculates consumption and updates the project and namespace statistics(legacy)
# or ProjectMonthlyUsage and NamespaceMonthlyUsage(not legacy) based on the passed build.
def execute(build)
if Feature.enabled?(:ci_always_track_shared_runners_usage, build.project, default_enabled: :yaml)
return unless build.complete?
return unless build.duration&.positive?
return unless build.shared_runner_build?
......@@ -14,25 +13,10 @@ module Ci
ci_minutes_consumed = ::Gitlab::Ci::Minutes::BuildConsumption.new(build, build.duration).amount
update_usage(build, ci_minutes_consumed)
else
legacy_update_minutes(build)
end
end
private
def legacy_update_minutes(build)
return unless build.cost_factor_enabled?
return unless build.complete?
return unless build.duration&.positive?
consumption = ::Gitlab::Ci::Minutes::BuildConsumption.new(build, build.duration).amount
return unless consumption > 0
::Ci::Minutes::UpdateProjectAndNamespaceUsageWorker.perform_async(consumption, project.id, namespace.id, build.id)
end
def update_usage(build, ci_minutes_consumed)
::Ci::Minutes::UpdateProjectAndNamespaceUsageWorker
.perform_async(ci_minutes_consumed, project.id, namespace.id, build.id, { duration: build.duration })
......
---
name: ci_always_track_shared_runners_usage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/72316
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/343258
milestone: '14.4'
type: development
group: group::pipeline execution
default_enabled: false
......@@ -128,14 +128,6 @@ RSpec.describe Ci::Minutes::UpdateBuildMinutesService do
subject
end
context 'when feature flag ci_always_track_shared_runners_usage is disabled' do
before do
stub_feature_flags(ci_always_track_shared_runners_usage: false)
end
it_behaves_like 'does nothing'
end
end
context 'when statistics and usage have existing amounts' do
......
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