diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /app/models/ci/runner.rb | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'app/models/ci/runner.rb')
-rw-r--r-- | app/models/ci/runner.rb | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index 432c3a408a9..4aa232ad26b 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -208,16 +208,18 @@ module Ci Arel.sql("(#{arel_tag_names_array.to_sql})") ] - group(*unique_params).pluck('array_agg(ci_runners.id)', *unique_params).map do |values| - Gitlab::Ci::Matching::RunnerMatcher.new({ - runner_ids: values[0], - runner_type: values[1], - public_projects_minutes_cost_factor: values[2], - private_projects_minutes_cost_factor: values[3], - run_untagged: values[4], - access_level: values[5], - tag_list: values[6] - }) + ::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/339621') do + group(*unique_params).pluck('array_agg(ci_runners.id)', *unique_params).map do |values| + Gitlab::Ci::Matching::RunnerMatcher.new({ + runner_ids: values[0], + runner_type: values[1], + public_projects_minutes_cost_factor: values[2], + private_projects_minutes_cost_factor: values[3], + run_untagged: values[4], + access_level: values[5], + tag_list: values[6] + }) + end end end @@ -385,6 +387,12 @@ module Ci read_attribute(:contacted_at) end + def namespace_ids + strong_memoize(:namespace_ids) do + runner_namespaces.pluck(:namespace_id).compact + end + end + private def cleanup_runner_queue @@ -420,14 +428,18 @@ module Ci end def no_projects - if projects.any? - errors.add(:runner, 'cannot have projects assigned') + ::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/338659') do + if projects.any? + errors.add(:runner, 'cannot have projects assigned') + end end end def no_groups - if groups.any? - errors.add(:runner, 'cannot have groups assigned') + ::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/338659') do + if groups.any? + errors.add(:runner, 'cannot have groups assigned') + end end end |