diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-01-13 09:56:05 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-01-14 12:48:16 +0100 |
commit | 0b946029a1fb429db39fbec0cddccf40f7e2aa08 (patch) | |
tree | 361c3e02ce3199700d693fdead687331ee3be510 /lib/ci | |
parent | 6d7a77074fcdd57ccdc33e3cb39146da4afdc0f4 (diff) | |
download | gitlab-ce-0b946029a1fb429db39fbec0cddccf40f7e2aa08.tar.gz |
Update build artifacts API
We do not want to allow runners to upload a metadata file. This needs to
be generated by Workhorse only.
Diffstat (limited to 'lib/ci')
-rw-r--r-- | lib/ci/api/builds.rb | 17 | ||||
-rw-r--r-- | lib/ci/api/entities.rb | 1 |
2 files changed, 8 insertions, 10 deletions
diff --git a/lib/ci/api/builds.rb b/lib/ci/api/builds.rb index 2aaa06a022c..be2790571cb 100644 --- a/lib/ci/api/builds.rb +++ b/lib/ci/api/builds.rb @@ -79,14 +79,13 @@ module Ci # id (required) - The ID of a build # token (required) - The build authorization token # file (required) - Artifacts file - # metadata (optional) - Artifacts metadata file # Parameters (accelerated by GitLab Workhorse): # file.path - path to locally stored body (generated by Workhorse) # file.name - real filename as send in Content-Disposition # file.type - real content type as send in Content-Type # metadata.path - path to locally stored body (generated by Workhorse) - # metadata.name - real filename as send in Content-Disposition - # metadata.type - real content type as send in Content-Type + # 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: @@ -101,19 +100,19 @@ module Ci not_found! unless build authenticate_build_token!(build) forbidden!('build is not running') unless build.running? + forbidden!('metadata reserved for workhorse') if params[:metadata] artifacts_upload_path = ArtifactUploader.artifacts_upload_path artifacts = uploaded_file!(:file, artifacts_upload_path) file_to_large! unless artifacts.size < max_artifacts_size - artifacts_attributes = { artifacts_file: artifacts } + build.artifacts_file = artifacts - if params[:metadata] || params['metadata.path'.to_sym] - metadata = uploaded_file!(:metadata, artifacts_upload_path) - artifacts_attributes.store(:artifacts_metadata, metadata) + if params[:'metadata.path'] && params[:'metadata.name'] + build.artifacts_metadata = uploaded_file!(:metadata, artifacts_upload_path) end - if build.update_attributes(artifacts_attributes) - present build, with: Entities::Build + if build.save + present(build, with: Entities::Build) else render_validation_error!(build) end diff --git a/lib/ci/api/entities.rb b/lib/ci/api/entities.rb index dd34c661e25..e4ac0545ea2 100644 --- a/lib/ci/api/entities.rb +++ b/lib/ci/api/entities.rb @@ -31,7 +31,6 @@ module Ci expose :variables expose :artifacts_file, using: ArtifactFile - expose :artifacts_metadata, using: ArtifactFile end class Runner < Grape::Entity |