diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-11-21 12:44:06 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-11-21 12:44:06 +0000 |
commit | 6a12e9d10768d0ff06b357be7ac975cebffa3584 (patch) | |
tree | 3691ba101789b4cf7ee90c5f63d9b4009803fc8b | |
parent | 25c7103484075dd8e2ff934d0aa5e4c7986df816 (diff) | |
parent | b53d3ac861c8b2f462d77248d5c507f24bcda7c6 (diff) | |
download | gitlab-ce-6a12e9d10768d0ff06b357be7ac975cebffa3584.tar.gz |
Merge branch 'sh-workaround-ruby-2-5-3-bug' into 'master'
Work around Ruby 2.5.3 crash when a CI job is selected
See merge request gitlab-org/gitlab-ce!23256
-rw-r--r-- | app/services/ci/register_job_service.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/services/ci/register_job_service.rb b/app/services/ci/register_job_service.rb index e06f1c05843..2abc4a67dd6 100644 --- a/app/services/ci/register_job_service.rb +++ b/app/services/ci/register_job_service.rb @@ -36,7 +36,7 @@ module Ci builds = builds.with_any_tags end - builds.find do |build| + selection = builds.find do |build| next unless runner.can_pick?(build) begin @@ -45,7 +45,7 @@ module Ci if assign_runner!(build, params) register_success(build) - return Result.new(build, true) # rubocop:disable Cop/AvoidReturnFromBlocks + break build end rescue StateMachines::InvalidTransition, ActiveRecord::StaleObjectError # We are looping to find another build that is not conflicting @@ -61,6 +61,8 @@ module Ci end end + return Result.new(selection, true) if selection + register_failure Result.new(nil, valid) end |