summaryrefslogtreecommitdiff
path: root/lib/api/jobs.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-09-04 14:09:03 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-09-04 14:09:03 +0200
commitf3f1ad3992c039563188a84787b1e916e367d702 (patch)
tree656de5d453bd96fef6049a8f77bab9dc08d9c62a /lib/api/jobs.rb
parentebbbc7ef52fbd1d3339e2e21be967d313a074a28 (diff)
downloadgitlab-ce-f3f1ad3992c039563188a84787b1e916e367d702.tar.gz
Add API endpoint for downloading single job artifact
Diffstat (limited to 'lib/api/jobs.rb')
-rw-r--r--lib/api/jobs.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/api/jobs.rb b/lib/api/jobs.rb
index 5bab96398fd..41b3b28037c 100644
--- a/lib/api/jobs.rb
+++ b/lib/api/jobs.rb
@@ -85,6 +85,25 @@ module API
present_artifacts!(build.artifacts_file)
end
+ desc 'Download a specific file from artifacts archive' do
+ detail 'This feature was introduced in GitLab 10.0'
+ end
+ params do
+ requires :job_id, type: Integer, desc: 'The ID of a job'
+ requires :artifact_path, type: String, desc: 'Artifact path'
+ end
+ get ':id/jobs/:job_id/artifacts/*artifact_path', format: false do
+ authorize_read_builds!
+
+ build = get_build!(params[:job_id])
+ not_found! unless build.artifacts?
+
+ entry = build.artifacts_metadata_entry(params[:artifact_path])
+ not_found! unless entry.exists?
+
+ Gitlab::Workhorse.send_artifacts_entry(build, entry)
+ end
+
desc 'Download the artifacts file from a job' do
detail 'This feature was introduced in GitLab 8.10'
end