summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/ci/build.rb4
-rw-r--r--lib/api/job_artifacts.rb15
2 files changed, 19 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 7930bef5cf2..40903aab5d0 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -588,6 +588,10 @@ module Ci
update_column(:trace, nil)
end
+ def metrics_file
+ job_artifacts_metrics&.file
+ end
+
def needs_touch?
Time.now - updated_at > 15.minutes.to_i
end
diff --git a/lib/api/job_artifacts.rb b/lib/api/job_artifacts.rb
index b35aa952f81..63a5bd40478 100644
--- a/lib/api/job_artifacts.rb
+++ b/lib/api/job_artifacts.rb
@@ -70,6 +70,21 @@ module API
present_carrierwave_file!(build.artifacts_file)
end
+ desc 'Download the artifact metrics from a job' do
+ detail 'This feature was introduced in GitLab 8.5'
+ end
+ params do
+ requires :job_id, type: Integer, desc: 'The ID of a job'
+ end
+ route_setting :authentication, job_token_allowed: true
+ get ':id/jobs/:job_id/metrics' do
+ authorize_download_artifacts!
+
+ build = find_build!(params[:job_id])
+
+ present_carrierwave_file!(build.metrics_file)
+ end
+
desc 'Download a specific file from artifacts archive' do
detail 'This feature was introduced in GitLab 10.0'
end