debian-mirror-gitlab/app/models/ci/runner_project.rb
2021-11-18 22:05:49 +05:30

21 lines
579 B
Ruby

# frozen_string_literal: true
module Ci
class RunnerProject < Ci::ApplicationRecord
include Limitable
self.limit_name = 'ci_registered_project_runners'
self.limit_scope = :project
self.limit_relation = :recent_runners
self.limit_feature_flag_for_override = :ci_runner_limits_override
belongs_to :runner, inverse_of: :runner_projects
belongs_to :project, inverse_of: :runner_projects
def recent_runners
::Ci::Runner.belonging_to_project(project_id).recent
end
validates :runner_id, uniqueness: { scope: :project_id }
end
end