Welcome to mirror list, hosted at ThFree Co, Russian Federation.

runner_project.rb « ci « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: af2595ce4afb34b4fa73c8bbd56fe5c904a55659 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module Ci
  class RunnerProject < ApplicationRecord
    extend Gitlab::Ci::Model
    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

    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