Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
dbd62232
Commit
dbd62232
authored
May 30, 2019
by
Fabio Pitino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert a default GIT_DEPTH for MR pipeline
parent
12aff0b7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
22 deletions
+10
-22
app/presenters/ci/build_runner_presenter.rb
app/presenters/ci/build_runner_presenter.rb
+2
-3
changelogs/unreleased/revert-git-depth-for-merge-request.yml
changelogs/unreleased/revert-git-depth-for-merge-request.yml
+5
-0
spec/presenters/ci/build_runner_presenter_spec.rb
spec/presenters/ci/build_runner_presenter_spec.rb
+3
-19
No files found.
app/presenters/ci/build_runner_presenter.rb
View file @
dbd62232
...
...
@@ -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
...
...
changelogs/unreleased/revert-git-depth-for-merge-request.yml
0 → 100644
View file @
dbd62232
---
title
:
Remove a default git depth in Pipelines for merge requests
merge_request
:
28926
author
:
type
:
fixed
spec/presenters/ci/build_runner_presenter_spec.rb
View file @
dbd62232
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment