Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
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 @@ class Projects::RunnersController < Projects::ApplicationController
...
@@ -20,7 +20,8 @@ class Projects::RunnersController < Projects::ApplicationController
if
@runner
.
update_attributes
(
runner_params
)
if
@runner
.
update_attributes
(
runner_params
)
redirect_to
runner_path
(
@runner
),
notice:
'Runner was successfully updated.'
redirect_to
runner_path
(
@runner
),
notice:
'Runner was successfully updated.'
else
else
redirect_to
runner_path
(
@runner
),
alert:
'Runner was not updated.'
flash
[
:alert
]
=
@runner
.
errors
.
full_messages
.
to_sentence
render
'edit'
end
end
end
end
...
...
app/models/ci/runner.rb
View file @
dd8e9e2d
...
@@ -26,6 +26,13 @@ module Ci
...
@@ -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
)
.
where
(
"ci_runner_projects.gl_project_id = :project_id OR ci_runners.is_shared = true"
,
project_id:
project_id
)
end
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
acts_as_taggable
# Searches for runners matching the given query.
# 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