Move project default git depth behind feature flags
This commit is contained in:
parent
9254b5d4c0
commit
3df74a4036
4 changed files with 25 additions and 1 deletions
|
@ -31,6 +31,8 @@ class ProjectCiCdSetting < ApplicationRecord
|
|||
private
|
||||
|
||||
def set_default_git_depth
|
||||
return unless Feature.enabled?(:ci_set_project_default_git_depth, default_enabled: true)
|
||||
|
||||
self.default_git_depth ||= DEFAULT_GIT_DEPTH
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ module Ci
|
|||
def git_depth
|
||||
if git_depth_variable
|
||||
git_depth_variable[:value]
|
||||
else
|
||||
elsif Feature.enabled?(:ci_project_git_depth, default_enabled: true)
|
||||
project.default_git_depth
|
||||
end.to_i
|
||||
end
|
||||
|
|
|
@ -48,5 +48,17 @@ describe ProjectCiCdSetting do
|
|||
|
||||
expect(project.reload.ci_cd_settings.default_git_depth).to eq(0)
|
||||
end
|
||||
|
||||
context 'when feature flag :ci_set_project_default_git_depth is disabled' do
|
||||
let(:project) { create(:project) }
|
||||
|
||||
before do
|
||||
stub_feature_flags(ci_set_project_default_git_depth: { enabled: false } )
|
||||
end
|
||||
|
||||
it 'does not set default value for new records' do
|
||||
expect(project.ci_cd_settings.default_git_depth).to eq(nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -136,6 +136,16 @@ describe Ci::BuildRunnerPresenter do
|
|||
it 'defaults to git depth setting for the project' do
|
||||
expect(git_depth).to eq(build.project.default_git_depth)
|
||||
end
|
||||
|
||||
context 'when feature flag :ci_project_git_depth is disabled' do
|
||||
before do
|
||||
stub_feature_flags(ci_project_git_depth: { enabled: false })
|
||||
end
|
||||
|
||||
it 'defaults to 0' do
|
||||
expect(git_depth).to eq(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#refspecs' do
|
||||
|
|
Loading…
Reference in a new issue