diff options
author | Kamil TrzciĆski <ayufan@ayufan.eu> | 2019-06-05 08:40:19 +0000 |
---|---|---|
committer | GitLab Release Tools Bot <delivery-team+release-tools@gitlab.com> | 2019-06-26 08:04:58 +0000 |
commit | 635e96a6ce4d28cec3ce776e1c9d00a71293e71f (patch) | |
tree | b7c354cb7bd31f2e02ed3a26d9a69cf7053f5cd1 | |
parent | 3c240b7aea7fee1c4267d0ceb717ba0234e5e788 (diff) | |
download | gitlab-ce-635e96a6ce4d28cec3ce776e1c9d00a71293e71f.tar.gz |
Merge branch 'revert-git-depth-for-merge-request' into 'master'
Revert a default GIT_DEPTH for MR pipeline
See merge request gitlab-org/gitlab-ce!28926
(cherry picked from commit 765917dc088bee52a3f95d76fc7f32d408a2af20)
dbd62232 Revert a default GIT_DEPTH for MR pipeline
-rw-r--r-- | app/presenters/ci/build_runner_presenter.rb | 5 | ||||
-rw-r--r-- | changelogs/unreleased/revert-git-depth-for-merge-request.yml | 5 | ||||
-rw-r--r-- | spec/presenters/ci/build_runner_presenter_spec.rb | 22 |
3 files changed, 10 insertions, 22 deletions
diff --git a/app/presenters/ci/build_runner_presenter.rb b/app/presenters/ci/build_runner_presenter.rb index ed3daf6585b..6d46e0bf18a 100644 --- a/app/presenters/ci/build_runner_presenter.rb +++ b/app/presenters/ci/build_runner_presenter.rb @@ -4,7 +4,6 @@ module Ci class BuildRunnerPresenter < SimpleDelegator include Gitlab::Utils::StrongMemoize - DEFAULT_GIT_DEPTH_MERGE_REQUEST = 10 RUNNER_REMOTE_TAG_PREFIX = 'refs/tags/'.freeze RUNNER_REMOTE_BRANCH_PREFIX = 'refs/remotes/origin/'.freeze @@ -28,7 +27,6 @@ module Ci def git_depth strong_memoize(:git_depth) do git_depth = variables&.find { |variable| variable[:key] == 'GIT_DEPTH' }&.dig(:value) - git_depth ||= DEFAULT_GIT_DEPTH_MERGE_REQUEST if merge_request_ref? git_depth.to_i end end @@ -39,12 +37,13 @@ module Ci if git_depth > 0 specs << refspec_for_branch(ref) if branch? || legacy_detached_merge_request_pipeline? specs << refspec_for_tag(ref) if tag? - specs << refspec_for_merge_request_ref if merge_request_ref? else specs << refspec_for_branch specs << refspec_for_tag end + specs << refspec_for_merge_request_ref if merge_request_ref? + specs end diff --git a/changelogs/unreleased/revert-git-depth-for-merge-request.yml b/changelogs/unreleased/revert-git-depth-for-merge-request.yml new file mode 100644 index 00000000000..3a258dff358 --- /dev/null +++ b/changelogs/unreleased/revert-git-depth-for-merge-request.yml @@ -0,0 +1,5 @@ +--- +title: Remove a default git depth in Pipelines for merge requests +merge_request: 28926 +author: +type: fixed diff --git a/spec/presenters/ci/build_runner_presenter_spec.rb b/spec/presenters/ci/build_runner_presenter_spec.rb index ad6cb012d0b..3430111ca9e 100644 --- a/spec/presenters/ci/build_runner_presenter_spec.rb +++ b/spec/presenters/ci/build_runner_presenter_spec.rb @@ -136,24 +136,6 @@ describe Ci::BuildRunnerPresenter do is_expected.to eq(1) end end - - context 'when pipeline is detached merge request pipeline' do - let(:merge_request) { create(:merge_request, :with_detached_merge_request_pipeline) } - let(:pipeline) { merge_request.all_pipelines.first } - let(:build) { create(:ci_build, ref: pipeline.ref, pipeline: pipeline) } - - it 'returns the default git depth for pipelines for merge requests' do - is_expected.to eq(described_class::DEFAULT_GIT_DEPTH_MERGE_REQUEST) - end - - context 'when pipeline is legacy detached merge request pipeline' do - let(:merge_request) { create(:merge_request, :with_legacy_detached_merge_request_pipeline) } - - it 'behaves as branch pipeline' do - is_expected.to eq(0) - end - end - end end describe '#refspecs' do @@ -191,7 +173,9 @@ describe Ci::BuildRunnerPresenter do it 'returns the correct refspecs' do is_expected - .to contain_exactly('+refs/merge-requests/1/head:refs/merge-requests/1/head') + .to contain_exactly('+refs/heads/*:refs/remotes/origin/*', + '+refs/tags/*:refs/tags/*', + '+refs/merge-requests/1/head:refs/merge-requests/1/head') end context 'when pipeline is legacy detached merge request pipeline' do |