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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
fe9fc0af
Commit
fe9fc0af
authored
Aug 22, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enfouce namespace for Kubernetes to lowercase
parent
539ed0a6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
app/models/project_services/kubernetes_service.rb
app/models/project_services/kubernetes_service.rb
+6
-0
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+2
-1
spec/models/project_services/kubernetes_service_spec.rb
spec/models/project_services/kubernetes_service_spec.rb
+2
-1
No files found.
app/models/project_services/kubernetes_service.rb
View file @
fe9fc0af
...
...
@@ -24,6 +24,8 @@ class KubernetesService < DeploymentService
validates
:token
end
before_validation
:enforce_namespace_to_lower_case
validates
:namespace
,
allow_blank:
true
,
length:
1
..
63
,
...
...
@@ -207,4 +209,8 @@ class KubernetesService < DeploymentService
max_session_time:
current_application_settings
.
terminal_max_session_time
}
end
def
enforce_namespace_to_lower_case
self
.
namespace
=
self
.
namespace
&
.
downcase
end
end
lib/gitlab/regex.rb
View file @
fe9fc0af
...
...
@@ -53,7 +53,8 @@ module Gitlab
end
def
kubernetes_namespace_regex_message
"can contain only letters, digits or '-', and cannot start or end with '-'"
"can contain only lowercase letters, digits, and '-'. "
\
"Must start with a letter, and cannot end with '-'"
end
def
environment_slug_regex
...
...
spec/models/project_services/kubernetes_service_spec.rb
View file @
fe9fc0af
...
...
@@ -38,7 +38,8 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
'a'
*
63
=>
true
,
'a'
*
64
=>
false
,
'a.b'
=>
false
,
'a*b'
=>
false
'a*b'
=>
false
,
'FOO'
=>
true
,
}.
each
do
|
namespace
,
validity
|
it
"validates
#{
namespace
}
as
#{
validity
?
'valid'
:
'invalid'
}
"
do
subject
.
namespace
=
namespace
...
...
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