diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-05-05 14:27:06 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-05-19 22:01:53 +0200 |
commit | dd8e9e2d7acf05b837a3bacd1258e9f3df4254a6 (patch) | |
tree | 3fad55f3a63506350711908260da20ca59c8d9cb /app/models | |
parent | 9129c37c5bd6e648e23ebe6847b909dd151c7e8a (diff) | |
download | gitlab-ce-dd8e9e2d7acf05b837a3bacd1258e9f3df4254a6.tar.gz |
Add custom validator to runner model
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/runner.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index 23b1556712c..b1227d72405 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -26,6 +26,13 @@ module Ci .where("ci_runner_projects.gl_project_id = :project_id OR ci_runners.is_shared = true", project_id: project_id) end + validate do |runner| + if runner.tag_list.empty? && !runner.run_untagged? + errors.add(:tags_errors, + 'Runner without tags must be able to pick untagged jobs!') + end + end + acts_as_taggable # Searches for runners matching the given query. |