summaryrefslogtreecommitdiff
path: root/lib/api/runner.rb
diff options
context:
space:
mode:
authorSam Rose <sam@gitlab.com>2017-04-06 21:02:25 -0400
committerSam Rose <sam@gitlab.com>2017-04-06 21:02:25 -0400
commitbb23534b37f0eff6075dbc1a3337009c9f19c327 (patch)
treec9f465801b7c907ab1160b3d0378e1087bf3507f /lib/api/runner.rb
parentb47d8a333c9aa554f6b820c6da101b67d85015c8 (diff)
parent3900aa803e574ddbcdb1a899f0e6085a0bb6c457 (diff)
downloadgitlab-ce-mr-shortcuts-counter.tar.gz
Update branch with latest stable commitsmr-shortcuts-counter
Diffstat (limited to 'lib/api/runner.rb')
-rw-r--r--lib/api/runner.rb15
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/api/runner.rb b/lib/api/runner.rb
index 4c9db2c8716..d288369e362 100644
--- a/lib/api/runner.rb
+++ b/lib/api/runner.rb
@@ -113,8 +113,7 @@ module API
optional :state, type: String, desc: %q(Job's status: success, failed)
end
put '/:id' do
- job = Ci::Build.find_by_id(params[:id])
- authenticate_job!(job)
+ job = authenticate_job!
job.update_attributes(trace: params[:trace]) if params[:trace]
@@ -140,8 +139,7 @@ module API
optional :token, type: String, desc: %q(Job's authentication token)
end
patch '/:id/trace' do
- job = Ci::Build.find_by_id(params[:id])
- authenticate_job!(job)
+ job = authenticate_job!
error!('400 Missing header Content-Range', 400) unless request.headers.has_key?('Content-Range')
content_range = request.headers['Content-Range']
@@ -175,8 +173,7 @@ module API
require_gitlab_workhorse!
Gitlab::Workhorse.verify_api_request!(headers)
- job = Ci::Build.find_by_id(params[:id])
- authenticate_job!(job)
+ job = authenticate_job!
forbidden!('Job is not running') unless job.running?
if params[:filesize]
@@ -212,8 +209,7 @@ module API
not_allowed! unless Gitlab.config.artifacts.enabled
require_gitlab_workhorse!
- job = Ci::Build.find_by_id(params[:id])
- authenticate_job!(job)
+ job = authenticate_job!
forbidden!('Job is not running!') unless job.running?
artifacts_upload_path = ArtifactUploader.artifacts_upload_path
@@ -245,8 +241,7 @@ module API
optional :token, type: String, desc: %q(Job's authentication token)
end
get '/:id/artifacts' do
- job = Ci::Build.find_by_id(params[:id])
- authenticate_job!(job)
+ job = authenticate_job!
artifacts_file = job.artifacts_file
unless artifacts_file.file_storage?