Skip to content
Snippets Groups Projects

Admin runner filtering by version

Merged Markus Ferrell requested to merge markus.ferrell/gitlab:admin_runner_sorting into master
All threads resolved!
1 file
+ 5
2
Compare changes
  • Side-by-side
  • Inline
@@ -63,8 +63,11 @@ class RunnerManager < Ci::ApplicationRecord
scope :order_id_desc, -> { order(id: :desc) }
scope :with_version_prefix, ->(value) do
where(arel_table[:version].matches("#{sanitize_sql_like(value)}%", nil, true))
end
prefix_format = '\d+\.'
prefix_format = value.match?(/\d+\.\d+\./) ? '\d+\.\d+\.' : prefix_format
prefix_format = value.match?(/\d+\.\d+\.\d+/) ? '\d+\.\d+\.\d+' : prefix_format
where("substring(#{quoted_table_name}.\"version\", ?::text) = ?", prefix_format, sanitize_sql_like(value)) # rubocop:disable GitlabSecurity/SqlInjection
end
scope :with_upgrade_status, ->(upgrade_status) do
joins(:runner_version).where(runner_version: { status: upgrade_status })
Loading