summaryrefslogtreecommitdiff
path: root/lib/api/runner.rb
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2018-06-07 17:27:26 +0200
committerTomasz Maczukin <tomasz@maczukin.pl>2018-06-07 18:45:48 +0200
commita6a900256e194c28d8342db9c2d67df784877c14 (patch)
treefabd5896948584c4c787aca84e59af166b1e13ec /lib/api/runner.rb
parent6fafc63117a9382ee088e364e83431ebd1b63a4a (diff)
downloadgitlab-ce-a6a900256e194c28d8342db9c2d67df784877c14.tar.gz
Change update entrypoint instead of adding new keep-alive one
Diffstat (limited to 'lib/api/runner.rb')
-rw-r--r--lib/api/runner.rb22
1 files changed, 4 insertions, 18 deletions
diff --git a/lib/api/runner.rb b/lib/api/runner.rb
index ac62b83ba4a..dc102259ca8 100644
--- a/lib/api/runner.rb
+++ b/lib/api/runner.rb
@@ -125,7 +125,7 @@ module API
end
put '/:id' do
job = authenticate_job!
- forbidden!('Job is not running') unless job.running?
+ job_forbidden!(job, 'Job is not running') unless job.running?
job.trace.set(params[:trace]) if params[:trace]
@@ -133,6 +133,8 @@ module API
project: job.project.full_path)
case params[:state].to_s
+ when 'running'
+ job.touch if job.needs_touch?
when 'success'
job.success!
when 'failed'
@@ -140,22 +142,6 @@ module API
end
end
- desc 'Marks job as live' do
- http_codes [[200, 'Request accepted']]
- end
- params do
- requires :id, type: Integer, desc: %q(Job's ID)
- optional :token, type: String, desc: %q(Job's authentication token)
- end
- post '/:id/keep-alive' do
- job = authenticate_job!
-
- job.touch if job.running? && job.needs_touch?
-
- status 200
- header 'Job-Status', job.status
- end
-
desc 'Appends a patch to the job trace' do
http_codes [[202, 'Trace was patched'],
[400, 'Missing Content-Range header'],
@@ -168,7 +154,7 @@ module API
end
patch '/:id/trace' do
job = authenticate_job!
- forbidden!('Job is not running') unless job.running?
+ job_forbidden!(job, 'Job is not running') unless job.running?
error!('400 Missing header Content-Range', 400) unless request.headers.key?('Content-Range')
content_range = request.headers['Content-Range']