Skip to content
Snippets Groups Projects
Commit f6dd8a52 authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Move runner validator to separate private method

parent 8ab4a67c
No related branches found
No related tags found
No related merge requests found
Loading
@@ -26,12 +26,7 @@ module Ci
Loading
@@ -26,12 +26,7 @@ module Ci
.where("ci_runner_projects.gl_project_id = :project_id OR ci_runners.is_shared = true", project_id: project_id) .where("ci_runner_projects.gl_project_id = :project_id OR ci_runners.is_shared = true", project_id: project_id)
end end
   
validate do |runner| validate :verify_tags_constraints
unless runner.has_tags? || runner.run_untagged?
errors.add(:tags_list,
'can not be empty when runner is not allowed to pick untagged jobs')
end
end
   
acts_as_taggable acts_as_taggable
   
Loading
@@ -107,5 +102,14 @@ module Ci
Loading
@@ -107,5 +102,14 @@ module Ci
def has_tags? def has_tags?
tag_list.any? tag_list.any?
end end
private
def verify_tags_constraints
unless has_tags? || run_untagged?
errors.add(:tags_list,
'can not be empty when runner is not allowed to pick untagged jobs')
end
end
end end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment