diff options
Diffstat (limited to 'lib/api/helpers/runner.rb')
-rw-r--r-- | lib/api/helpers/runner.rb | 11 |
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 |