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
0bd8f559
Commit
0bd8f559
authored
Sep 10, 2020
by
Justin Zeng
Committed by
Heinrich Lee Yu
Sep 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added `pipeline` parameter to MergeRequestsController
parent
a4a25c0a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
8 deletions
+53
-8
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+7
-1
ee/app/controllers/ee/projects/merge_requests_controller.rb
ee/app/controllers/ee/projects/merge_requests_controller.rb
+7
-7
ee/changelogs/unreleased/241063-add-pipeline-parameter-to-MergeRequestsController.yml
...063-add-pipeline-parameter-to-MergeRequestsController.yml
+5
-0
ee/spec/controllers/projects/merge_requests_controller_spec.rb
...ec/controllers/projects/merge_requests_controller_spec.rb
+34
-0
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
0bd8f559
...
...
@@ -428,7 +428,13 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
Gitlab
::
QueryLimiting
.
whitelist
(
'https://gitlab.com/gitlab-org/gitlab-foss/issues/42438'
)
end
def
reports_response
(
report_comparison
)
def
reports_response
(
report_comparison
,
pipeline
=
nil
)
if
pipeline
&
.
active?
::
Gitlab
::
PollingInterval
.
set_header
(
response
,
interval:
3000
)
render
json:
''
,
status: :no_content
&&
return
end
case
report_comparison
[
:status
]
when
:parsing
::
Gitlab
::
PollingInterval
.
set_header
(
response
,
interval:
3000
)
...
...
ee/app/controllers/ee/projects/merge_requests_controller.rb
View file @
0bd8f559
...
...
@@ -28,27 +28,27 @@ module EE
end
def
license_scanning_reports
reports_response
(
merge_request
.
compare_license_scanning_reports
(
current_user
))
reports_response
(
merge_request
.
compare_license_scanning_reports
(
current_user
)
,
head_pipeline
)
end
def
container_scanning_reports
reports_response
(
merge_request
.
compare_container_scanning_reports
(
current_user
))
reports_response
(
merge_request
.
compare_container_scanning_reports
(
current_user
)
,
head_pipeline
)
end
def
dependency_scanning_reports
reports_response
(
merge_request
.
compare_dependency_scanning_reports
(
current_user
))
reports_response
(
merge_request
.
compare_dependency_scanning_reports
(
current_user
)
,
head_pipeline
)
end
def
sast_reports
reports_response
(
merge_request
.
compare_sast_reports
(
current_user
))
reports_response
(
merge_request
.
compare_sast_reports
(
current_user
)
,
head_pipeline
)
end
def
secret_detection_reports
reports_response
(
merge_request
.
compare_secret_detection_reports
(
current_user
))
reports_response
(
merge_request
.
compare_secret_detection_reports
(
current_user
)
,
head_pipeline
)
end
def
dast_reports
reports_response
(
merge_request
.
compare_dast_reports
(
current_user
))
reports_response
(
merge_request
.
compare_dast_reports
(
current_user
)
,
head_pipeline
)
end
def
metrics_reports
...
...
@@ -56,7 +56,7 @@ module EE
end
def
coverage_fuzzing_reports
reports_response
(
merge_request
.
compare_coverage_fuzzing_reports
(
current_user
))
reports_response
(
merge_request
.
compare_coverage_fuzzing_reports
(
current_user
)
,
head_pipeline
)
end
private
...
...
ee/changelogs/unreleased/241063-add-pipeline-parameter-to-MergeRequestsController.yml
0 → 100644
View file @
0bd8f559
---
title
:
Disable loading vulnerabilities in MR when pipeline is running
merge_request
:
41539
author
:
Justin Zeng
type
:
fixed
ee/spec/controllers/projects/merge_requests_controller_spec.rb
View file @
0bd8f559
...
...
@@ -25,6 +25,28 @@ RSpec.shared_examples 'authorize read pipeline' do
end
end
RSpec
.
shared_examples
'pending pipeline response'
do
context
'when pipeline is pending'
do
let
(
:comparison_status
)
{
nil
}
before
do
merge_request
.
head_pipeline
.
run!
end
it
'sends polling interval'
do
expect
(
::
Gitlab
::
PollingInterval
).
to
receive
(
:set_header
)
subject
end
it
'returns 204 HTTP status'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:no_content
)
end
end
end
RSpec
.
describe
Projects
::
MergeRequestsController
do
include
ProjectForksHelper
...
...
@@ -332,6 +354,8 @@ RSpec.describe Projects::MergeRequestsController do
.
with
(
::
Ci
::
CompareSecurityReportsService
,
viewer
,
'dependency_scanning'
).
and_return
(
comparison_status
)
end
it_behaves_like
'pending pipeline response'
context
'when comparison is being processed'
do
let
(
:comparison_status
)
{
{
status: :parsing
}
}
...
...
@@ -402,6 +426,8 @@ RSpec.describe Projects::MergeRequestsController do
.
with
(
::
Ci
::
CompareSecurityReportsService
,
viewer
,
'container_scanning'
).
and_return
(
comparison_status
)
end
it_behaves_like
'pending pipeline response'
context
'when comparison is being processed'
do
let
(
:comparison_status
)
{
{
status: :parsing
}
}
...
...
@@ -472,6 +498,8 @@ RSpec.describe Projects::MergeRequestsController do
.
with
(
::
Ci
::
CompareSecurityReportsService
,
viewer
,
'sast'
).
and_return
(
comparison_status
)
end
it_behaves_like
'pending pipeline response'
context
'when comparison is being processed'
do
let
(
:comparison_status
)
{
{
status: :parsing
}
}
...
...
@@ -543,6 +571,8 @@ RSpec.describe Projects::MergeRequestsController do
.
with
(
::
Ci
::
CompareSecurityReportsService
,
viewer
,
'secret_detection'
).
and_return
(
comparison_status
)
end
it_behaves_like
'pending pipeline response'
context
'when comparison is being processed'
do
let
(
:comparison_status
)
{
{
status: :parsing
}
}
...
...
@@ -613,6 +643,8 @@ RSpec.describe Projects::MergeRequestsController do
.
with
(
::
Ci
::
CompareSecurityReportsService
,
viewer
,
'dast'
).
and_return
(
comparison_status
)
end
it_behaves_like
'pending pipeline response'
context
'when comparison is being processed'
do
let
(
:comparison_status
)
{
{
status: :parsing
}
}
...
...
@@ -684,6 +716,8 @@ RSpec.describe Projects::MergeRequestsController do
.
with
(
::
Ci
::
CompareLicenseScanningReportsService
,
viewer
).
and_return
(
comparison_status
)
end
it_behaves_like
'pending pipeline response'
context
'when comparison is being processed'
do
let
(
:comparison_status
)
{
{
status: :parsing
}
}
...
...
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