Commit 37cfb7c0 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge remote-tracking branch 'ee-com/dz-refactor-specific-build-artifacts'...

Merge remote-tracking branch 'ee-com/dz-refactor-specific-build-artifacts' into 4249-show-results-from-docker-image-scan-in-the-merge-request-widget
parents 9b454740 8b386ec0
......@@ -9,6 +9,7 @@ module EE
CODEQUALITY_FILE = 'codeclimate.json'.freeze
SAST_FILE = 'gl-sast-report.json'.freeze
PERFORMANCE_FILE = 'performance.json'.freeze
CLAIR_FILE = 'gl-clair-report.json'.freeze
included do
......@@ -36,8 +37,7 @@ module EE
end
def has_performance_json?
options.dig(:artifacts, :paths) == ['performance.json'] &&
artifacts_metadata?
has_artifact?(PERFORMANCE_FILE)
end
def has_sast_json?
......
......@@ -29,13 +29,13 @@ module EE
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')
path: Ci::Build::PERFORMANCE_FILE)
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')
path: Ci::Build::PERFORMANCE_FILE)
end
end
......@@ -72,15 +72,15 @@ module EE
can?(current_user, :read_build, mr.sast_artifact)
end
def expose_performance_data?(mr)
mr.project.feature_available?(:merge_request_performance_metrics) &&
mr.has_performance_data?
end
def expose_clair_data?(mr, current_user)
mr.project.feature_available?(:clair) &&
mr.has_clair_data? &&
can?(current_user, :read_build, mr.clair_artifact)
end
def expose_performance_data?(mr)
mr.project.feature_available?(:merge_request_performance_metrics) &&
mr.has_performance_data?
end
end
end
......@@ -129,10 +129,10 @@ describe Ci::Build do
end
ARTIFACTS_METHODS = {
has_codeclimate_json?: 'codeclimate.json',
has_performance_json?: 'performance.json',
has_sast_json?: 'gl-sast-report.json',
has_clair_json?: 'gl-clair-report.json'
has_codeclimate_json?: Ci::Build::CODEQUALITY_FILE,
has_performance_json?: Ci::Build::PERFORMANCE_FILE,
has_sast_json?: Ci::Build::SAST_FILE,
has_clair_json?: Ci::Build::CLAIR_FILE
}.freeze
ARTIFACTS_METHODS.each do |method, filename|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment