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
b64bcf98
Commit
b64bcf98
authored
Dec 05, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add performance artifacts to the merge request widget
parent
b78705f4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
0 deletions
+31
-0
ee/app/models/ee/ci/build.rb
ee/app/models/ee/ci/build.rb
+6
-0
ee/app/models/ee/ci/pipeline.rb
ee/app/models/ee/ci/pipeline.rb
+4
-0
ee/app/models/ee/merge_request.rb
ee/app/models/ee/merge_request.rb
+7
-0
ee/app/serializers/ee/merge_request_entity.rb
ee/app/serializers/ee/merge_request_entity.rb
+14
-0
No files found.
ee/app/models/ee/ci/build.rb
View file @
b64bcf98
...
@@ -9,6 +9,7 @@ module EE
...
@@ -9,6 +9,7 @@ module EE
included
do
included
do
scope
:codequality
,
->
()
{
where
(
name:
%w[codequality codeclimate]
)
}
scope
:codequality
,
->
()
{
where
(
name:
%w[codequality codeclimate]
)
}
scope
:performance
,
->
()
{
where
(
name:
%w[performance deploy]
)
}
scope
:sast
,
->
()
{
where
(
name:
'sast'
)
}
scope
:sast
,
->
()
{
where
(
name:
'sast'
)
}
after_save
:stick_build_if_status_changed
after_save
:stick_build_if_status_changed
...
@@ -30,6 +31,11 @@ module EE
...
@@ -30,6 +31,11 @@ module EE
artifacts_metadata?
artifacts_metadata?
end
end
def
has_performance_json?
options
.
dig
(
:artifacts
,
:paths
)
==
[
'performance.json'
]
&&
artifacts_metadata?
end
def
has_sast_json?
def
has_sast_json?
options
.
dig
(
:artifacts
,
:paths
)
==
[
'gl-sast-report.json'
]
&&
options
.
dig
(
:artifacts
,
:paths
)
==
[
'gl-sast-report.json'
]
&&
artifacts_metadata?
artifacts_metadata?
...
...
ee/app/models/ee/ci/pipeline.rb
View file @
b64bcf98
...
@@ -17,6 +17,10 @@ module EE
...
@@ -17,6 +17,10 @@ module EE
artifacts
.
codequality
.
find
(
&
:has_codeclimate_json?
)
artifacts
.
codequality
.
find
(
&
:has_codeclimate_json?
)
end
end
def
performance_artifact
artifacts
.
performance
.
find
(
&
:has_performance_json?
)
end
def
sast_artifact
def
sast_artifact
artifacts
.
sast
.
find
(
&
:has_sast_json?
)
artifacts
.
sast
.
find
(
&
:has_sast_json?
)
end
end
...
...
ee/app/models/ee/merge_request.rb
View file @
b64bcf98
...
@@ -11,6 +11,8 @@ module EE
...
@@ -11,6 +11,8 @@ module EE
delegate
:codeclimate_artifact
,
to: :head_pipeline
,
prefix: :head
,
allow_nil:
true
delegate
:codeclimate_artifact
,
to: :head_pipeline
,
prefix: :head
,
allow_nil:
true
delegate
:codeclimate_artifact
,
to: :base_pipeline
,
prefix: :base
,
allow_nil:
true
delegate
:codeclimate_artifact
,
to: :base_pipeline
,
prefix: :base
,
allow_nil:
true
delegate
:performance_artifact
,
to: :head_pipeline
,
prefix: :head
,
allow_nil:
true
delegate
:performance_artifact
,
to: :base_pipeline
,
prefix: :base
,
allow_nil:
true
delegate
:sast_artifact
,
to: :head_pipeline
,
allow_nil:
true
delegate
:sast_artifact
,
to: :head_pipeline
,
allow_nil:
true
delegate
:sha
,
to: :head_pipeline
,
prefix: :head_pipeline
,
allow_nil:
true
delegate
:sha
,
to: :head_pipeline
,
prefix: :head_pipeline
,
allow_nil:
true
delegate
:sha
,
to: :base_pipeline
,
prefix: :base_pipeline
,
allow_nil:
true
delegate
:sha
,
to: :base_pipeline
,
prefix: :base_pipeline
,
allow_nil:
true
...
@@ -44,6 +46,11 @@ module EE
...
@@ -44,6 +46,11 @@ module EE
base_codeclimate_artifact
&
.
success?
)
base_codeclimate_artifact
&
.
success?
)
end
end
def
has_performance_data?
!!
(
head_performance_artifact
&
.
success?
&&
base_performance_artifact
&
.
success?
)
end
def
has_sast_data?
def
has_sast_data?
sast_artifact
&
.
success?
sast_artifact
&
.
success?
end
end
...
...
ee/app/serializers/ee/merge_request_entity.rb
View file @
b64bcf98
...
@@ -25,6 +25,20 @@ module EE
...
@@ -25,6 +25,20 @@ module EE
end
end
end
end
expose
:performance
,
if:
->
(
mr
,
_
)
{
mr
.
has_performance_data?
}
do
expose
:head_path
,
if:
->
(
mr
,
_
)
{
can?
(
current_user
,
:read_build
,
mr
.
head_performance_artifact
)
}
do
|
merge_request
|
raw_project_build_artifacts_url
(
merge_request
.
source_project
,
merge_request
.
head_performance_artifact
,
path:
'performance.json'
)
end
expose
:base_path
,
if:
->
(
mr
,
_
)
{
can?
(
current_user
,
:read_build
,
mr
.
base_performance_artifact
)
}
do
|
merge_request
|
raw_project_build_artifacts_url
(
merge_request
.
target_project
,
merge_request
.
base_performance_artifact
,
path:
'performance.json'
)
end
end
expose
:sast
,
if:
->
(
mr
,
_
)
{
expose_sast_data?
(
mr
,
current_user
)
}
do
expose
:sast
,
if:
->
(
mr
,
_
)
{
expose_sast_data?
(
mr
,
current_user
)
}
do
expose
:path
do
|
merge_request
|
expose
:path
do
|
merge_request
|
raw_project_build_artifacts_url
(
merge_request
.
source_project
,
raw_project_build_artifacts_url
(
merge_request
.
source_project
,
...
...
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