summaryrefslogtreecommitdiff
path: root/lib/ci
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-01-13 14:02:36 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-01-14 12:48:17 +0100
commit154b8ceba4ac2d92a2387ad50d7f2b4ed5b2dd8a (patch)
tree795172bfd14ab647cd504b9cec67bb95608242a9 /lib/ci
parent3f0c18f80e36561581ef6fa6dbfcec169e1a6e08 (diff)
downloadgitlab-ce-154b8ceba4ac2d92a2387ad50d7f2b4ed5b2dd8a.tar.gz
Refactor build artifacts upload API endpoint
Diffstat (limited to 'lib/ci')
-rw-r--r--lib/ci/api/builds.rb15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/ci/api/builds.rb b/lib/ci/api/builds.rb
index be2790571cb..fb87637b94f 100644
--- a/lib/ci/api/builds.rb
+++ b/lib/ci/api/builds.rb
@@ -85,7 +85,6 @@ module Ci
# file.type - real content type as send in Content-Type
# metadata.path - path to locally stored body (generated by Workhorse)
# metadata.name - filename (generated by Workhorse)
- # metadata.type - content type (returned by Workhorse)
# Headers:
# BUILD-TOKEN (required) - The build authorization token, the same as token
# Body:
@@ -99,17 +98,17 @@ module Ci
build = Ci::Build.find_by_id(params[:id])
not_found! unless build
authenticate_build_token!(build)
- forbidden!('build is not running') unless build.running?
- forbidden!('metadata reserved for workhorse') if params[:metadata]
+ forbidden!('Build is not running!') unless build.running?
artifacts_upload_path = ArtifactUploader.artifacts_upload_path
- artifacts = uploaded_file!(:file, artifacts_upload_path)
+ artifacts = uploaded_file(:file, artifacts_upload_path)
+ metadata = uploaded_file(:metadata, artifacts_upload_path)
+
+ bad_request!('Missing artifacts file!') unless artifacts
file_to_large! unless artifacts.size < max_artifacts_size
- build.artifacts_file = artifacts
- if params[:'metadata.path'] && params[:'metadata.name']
- build.artifacts_metadata = uploaded_file!(:metadata, artifacts_upload_path)
- end
+ build.artifacts_file = artifacts
+ build.artifacts_metadata = metadata
if build.save
present(build, with: Entities::Build)