Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GitLab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
projects.thm.de
GitLab
Commits
dd8e9e2d
Commit
dd8e9e2d
authored
May 05, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add custom validator to runner model
parent
9129c37c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
app/controllers/projects/runners_controller.rb
app/controllers/projects/runners_controller.rb
+2
-1
app/models/ci/runner.rb
app/models/ci/runner.rb
+7
-0
No files found.
app/controllers/projects/runners_controller.rb
View file @
dd8e9e2d
...
...
@@ -20,7 +20,8 @@ def update
if
@runner
.
update_attributes
(
runner_params
)
redirect_to
runner_path
(
@runner
),
notice:
'Runner was successfully updated.'
else
redirect_to
runner_path
(
@runner
),
alert:
'Runner was not updated.'
flash
[
:alert
]
=
@runner
.
errors
.
full_messages
.
to_sentence
render
'edit'
end
end
...
...
app/models/ci/runner.rb
View file @
dd8e9e2d
...
...
@@ -26,6 +26,13 @@ class Runner < ActiveRecord::Base
.
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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment