summaryrefslogtreecommitdiff
path: root/lib/api/helpers/runner.rb
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2017-02-28 12:52:08 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2017-03-02 17:45:46 +0100
commitd5f7e5421157dbd1be134247dfec318c0db546a8 (patch)
tree21bdabb649cb1986eac60f6e2320c9de2ae1c668 /lib/api/helpers/runner.rb
parentfb8210ad19dcf012ffd1a99a649846d82870b8af (diff)
downloadgitlab-ce-d5f7e5421157dbd1be134247dfec318c0db546a8.tar.gz
Add job update API
Diffstat (limited to 'lib/api/helpers/runner.rb')
-rw-r--r--lib/api/helpers/runner.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/api/helpers/runner.rb b/lib/api/helpers/runner.rb
index 8204adbcfe5..15eb6b932ed 100644
--- a/lib/api/helpers/runner.rb
+++ b/lib/api/helpers/runner.rb
@@ -39,13 +39,22 @@ module API
(Time.now - current_runner.contacted_at) >= contacted_at_max_age
end
- def build_not_found!
+ def job_not_found!
if headers['User-Agent'].to_s.match(/gitlab(-ci-multi)?-runner \d+\.\d+\.\d+(~beta\.\d+\.g[0-9a-f]+)? /)
no_content!
else
not_found!
end
end
+
+ def validate_job!(job)
+ not_found! unless job
+
+ yield if block_given?
+
+ forbidden!('Project has been deleted!') unless job.project
+ forbidden!('Job has been erased!') if job.erased?
+ end
end
end
end