Commit 42df9492 authored by Marius Bobin's avatar Marius Bobin

Merge branch 'add-ff-to-skip-legacy-ci-minutes-recalculation' into 'master'

Add feature flag to skip extra minutes recalculation

See merge request gitlab-org/gitlab!78476
parents 0d70ef75 683615af
---
name: ci_skip_legacy_extra_minutes_recalculation
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/78476
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/341730
milestone: '14.8'
type: development
group: group::pipeline execution
default_enabled: false
......@@ -63,6 +63,7 @@ module Ci
# rubocop: disable CodeReuse/ActiveRecord
def recalculate_extra_shared_runners_minutes_limits!(namespaces)
return if Feature.enabled?(:ci_use_new_monthly_minutes, default_enabled: :yaml)
return if Feature.enabled?(:ci_skip_legacy_extra_minutes_recalculation, default_enabled: :yaml)
namespaces
.joins(:namespace_statistics)
......
......@@ -53,7 +53,7 @@ RSpec.describe Ci::Minutes::BatchResetService do
subject
end
context 'when feature flag ci_use_new_monthly_minutes is enabled' do
context 'when feature flags ci_use_new_monthly_minutes and ci_skip_legacy_extra_minutes_recalculation are enabled' do
it 'resets CI minutes but does not recalculate purchased minutes for the namespace exceeding the monthly minutes' do
subject
......@@ -71,9 +71,11 @@ RSpec.describe Ci::Minutes::BatchResetService do
end
end
context 'when feature flag ci_use_new_monthly_minutes is disabled' do
context 'when feature flag ci_use_new_monthly_minutes and ci_skip_legacy_extra_minutes_recalculation are disabled' do
before do
stub_feature_flags(ci_use_new_monthly_minutes: false)
stub_feature_flags(
ci_use_new_monthly_minutes: false,
ci_skip_legacy_extra_minutes_recalculation: false)
end
it 'resets CI minutes and recalculates purchased minutes for the namespace exceeding the monthly minutes' do
......@@ -153,7 +155,9 @@ RSpec.describe Ci::Minutes::BatchResetService do
before do
allow(::Gitlab::CurrentSettings).to receive(:shared_runners_minutes).and_return(global_limit)
stub_feature_flags(ci_use_new_monthly_minutes: false)
stub_feature_flags(
ci_use_new_monthly_minutes: false,
ci_skip_legacy_extra_minutes_recalculation: false)
end
it 'does not recalculate purchased minutes for any namespaces' do
......
......@@ -74,9 +74,11 @@ RSpec.describe Ci::BatchResetMinutesWorker do
end
end
context 'when ci_use_new_monthly_minutes is disabled' do
context 'when ci_use_new_monthly_minutes and ci_skip_legacy_extra_minutes_recalculation are disabled' do
before do
stub_feature_flags(ci_use_new_monthly_minutes: false)
stub_feature_flags(
ci_use_new_monthly_minutes: false,
ci_skip_legacy_extra_minutes_recalculation: false)
end
it 'recalculates purchased minutes for the namespace exceeding the monthly minutes' 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