gitlab-org--gitlab-foss/app/models/ci/runner_project.rb

23 lines
627 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2015-08-26 01:42:46 +00:00
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 = :ci_runner_limits
self.limit_feature_flag_for_override = :ci_runner_limits_override
2017-03-17 23:06:11 +00:00
2018-05-28 11:07:28 +00:00
belongs_to :runner, inverse_of: :runner_projects
belongs_to :project, inverse_of: :runner_projects
2015-08-26 01:42:46 +00:00
def recent_runners
::Ci::Runner.belonging_to_project(project_id).recent
end
2017-03-17 23:06:11 +00:00
validates :runner_id, uniqueness: { scope: :project_id }
2015-08-26 01:42:46 +00:00
end
end