Use a separate method to skip validation
Feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8091#note_20222666
This commit is contained in:
parent
4bf59f87b3
commit
64d7772b6f
|
@ -41,7 +41,7 @@ module Ci
|
|||
put ":id" do
|
||||
authenticate_runner!
|
||||
build = Ci::Build.where(runner_id: current_runner.id).running.find(params[:id])
|
||||
authenticate_build!(build, verify_token: false)
|
||||
validate_build!(build)
|
||||
|
||||
update_runner_info
|
||||
|
||||
|
|
|
@ -13,9 +13,14 @@ module Ci
|
|||
forbidden! unless current_runner
|
||||
end
|
||||
|
||||
def authenticate_build!(build, verify_token: true)
|
||||
def authenticate_build!(build)
|
||||
not_found! unless build
|
||||
forbidden! if !build_token_valid?(build)
|
||||
validate_build!(build)
|
||||
end
|
||||
|
||||
def validate_build!(build)
|
||||
not_found! unless build
|
||||
forbidden! if verify_token && !build_token_valid?(build)
|
||||
forbidden!('Project has been deleted!') unless build.project
|
||||
forbidden!('Build has been erased!') if build.erased?
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue