Commit 3df74a40 authored by Fabio Pitino's avatar Fabio Pitino Committed by Kamil Trzciński

Move project default git depth behind feature flags

parent 9254b5d4
......@@ -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
......
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