Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2018-06-07 18:27:26 +0300
committerTomasz Maczukin <tomasz@maczukin.pl>2018-06-07 19:45:48 +0300
commita6a900256e194c28d8342db9c2d67df784877c14 (patch)
treefabd5896948584c4c787aca84e59af166b1e13ec /lib
parent6fafc63117a9382ee088e364e83431ebd1b63a4a (diff)
Change update entrypoint instead of adding new keep-alive one
Diffstat (limited to 'lib')
-rw-r--r--lib/api/helpers/runner.rb5
-rw-r--r--lib/api/runner.rb22
2 files changed, 9 insertions, 18 deletions
diff --git a/lib/api/helpers/runner.rb b/lib/api/helpers/runner.rb
index 35ac0b4cbca..61eb88d3331 100644
--- a/lib/api/helpers/runner.rb
+++ b/lib/api/helpers/runner.rb
@@ -59,6 +59,11 @@ module API
def max_artifacts_size
Gitlab::CurrentSettings.max_artifacts_size.megabytes.to_i
end
+
+ def job_forbidden!(job, reason)
+ header 'Job-Status', job.status
+ forbidden!(reason)
+ end
end
end
end
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']