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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/ci/runner_namespace.rb')
-rw-r--r--app/models/ci/runner_namespace.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/ci/runner_namespace.rb b/app/models/ci/runner_namespace.rb
index 6903e8a21a1..e6c1899c89d 100644
--- a/app/models/ci/runner_namespace.rb
+++ b/app/models/ci/runner_namespace.rb
@@ -4,10 +4,17 @@ module Ci
class RunnerNamespace < ApplicationRecord
extend Gitlab::Ci::Model
- belongs_to :runner, inverse_of: :runner_namespaces, validate: true
+ belongs_to :runner, inverse_of: :runner_namespaces
belongs_to :namespace, inverse_of: :runner_namespaces, class_name: '::Namespace'
belongs_to :group, class_name: '::Group', foreign_key: :namespace_id
validates :runner_id, uniqueness: { scope: :namespace_id }
+ validate :group_runner_type
+
+ private
+
+ def group_runner_type
+ errors.add(:runner, 'is not a group runner') unless runner&.group_type?
+ end
end
end