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
4fd05ce9
Commit
4fd05ce9
authored
May 18, 2020
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Redundant Persistent Ref existence check
This commit addresses mitigates the performance concern.
parent
f958fd99
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
6 deletions
+22
-6
app/presenters/ci/build_runner_presenter.rb
app/presenters/ci/build_runner_presenter.rb
+7
-0
spec/presenters/ci/build_runner_presenter_spec.rb
spec/presenters/ci/build_runner_presenter_spec.rb
+7
-3
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+8
-3
No files found.
app/presenters/ci/build_runner_presenter.rb
View file @
4fd05ce9
...
...
@@ -97,6 +97,13 @@ module Ci
end
def
persistent_ref_exist?
##
# Persistent refs for pipelines definitely exist from GitLab 12.4,
# hence, we don't need to check the ref existence before passing it to runners.
# Checking refs pressurizes gitaly node and should be avoided.
# Issue: https://gitlab.com/gitlab-com/gl-infra/production/-/issues/2143
return
true
if
Feature
.
enabled?
(
:ci_skip_persistent_ref_existence_check
)
pipeline
.
persistent_ref
.
exist?
end
...
...
spec/presenters/ci/build_runner_presenter_spec.rb
View file @
4fd05ce9
...
...
@@ -185,16 +185,19 @@ describe Ci::BuildRunnerPresenter do
subject
{
presenter
.
refspecs
}
let
(
:build
)
{
create
(
:ci_build
)
}
let
(
:pipeline
)
{
build
.
pipeline
}
it
'returns the correct refspecs'
do
is_expected
.
to
contain_exactly
(
"+refs/heads/
#{
build
.
ref
}
:refs/remotes/origin/
#{
build
.
ref
}
"
)
is_expected
.
to
contain_exactly
(
"+refs/heads/
#{
build
.
ref
}
:refs/remotes/origin/
#{
build
.
ref
}
"
,
"+refs/pipelines/
#{
pipeline
.
id
}
:refs/pipelines/
#{
pipeline
.
id
}
"
)
end
context
'when ref is tag'
do
let
(
:build
)
{
create
(
:ci_build
,
:tag
)
}
it
'returns the correct refspecs'
do
is_expected
.
to
contain_exactly
(
"+refs/tags/
#{
build
.
ref
}
:refs/tags/
#{
build
.
ref
}
"
)
is_expected
.
to
contain_exactly
(
"+refs/tags/
#{
build
.
ref
}
:refs/tags/
#{
build
.
ref
}
"
,
"+refs/pipelines/
#{
pipeline
.
id
}
:refs/pipelines/
#{
pipeline
.
id
}
"
)
end
context
'when GIT_DEPTH is zero'
do
...
...
@@ -204,7 +207,8 @@ describe Ci::BuildRunnerPresenter do
it
'returns the correct refspecs'
do
is_expected
.
to
contain_exactly
(
'+refs/tags/*:refs/tags/*'
,
'+refs/heads/*:refs/remotes/origin/*'
)
'+refs/heads/*:refs/remotes/origin/*'
,
"+refs/pipelines/
#{
pipeline
.
id
}
:refs/pipelines/
#{
pipeline
.
id
}
"
)
end
end
end
...
...
spec/requests/api/runner_spec.rb
View file @
4fd05ce9
...
...
@@ -471,7 +471,8 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
'sha'
=>
job
.
sha
,
'before_sha'
=>
job
.
before_sha
,
'ref_type'
=>
'branch'
,
'refspecs'
=>
[
"+refs/heads/
#{
job
.
ref
}
:refs/remotes/origin/
#{
job
.
ref
}
"
],
'refspecs'
=>
[
"+refs/pipelines/
#{
pipeline
.
id
}
:refs/pipelines/
#{
pipeline
.
id
}
"
,
"+refs/heads/
#{
job
.
ref
}
:refs/remotes/origin/
#{
job
.
ref
}
"
],
'depth'
=>
project
.
ci_default_git_depth
}
end
...
...
@@ -578,7 +579,9 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'git_info'
][
'refspecs'
])
.
to
contain_exactly
(
'+refs/tags/*:refs/tags/*'
,
'+refs/heads/*:refs/remotes/origin/*'
)
.
to
contain_exactly
(
"+refs/pipelines/
#{
pipeline
.
id
}
:refs/pipelines/
#{
pipeline
.
id
}
"
,
'+refs/tags/*:refs/tags/*'
,
'+refs/heads/*:refs/remotes/origin/*'
)
end
end
end
...
...
@@ -638,7 +641,9 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'git_info'
][
'refspecs'
])
.
to
contain_exactly
(
'+refs/tags/*:refs/tags/*'
,
'+refs/heads/*:refs/remotes/origin/*'
)
.
to
contain_exactly
(
"+refs/pipelines/
#{
pipeline
.
id
}
:refs/pipelines/
#{
pipeline
.
id
}
"
,
'+refs/tags/*:refs/tags/*'
,
'+refs/heads/*:refs/remotes/origin/*'
)
end
end
end
...
...
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