BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
kubernetes_service.rb
app/models/project_services/kubernetes_service.rb
+6
-0
regex.rb
lib/gitlab/regex.rb
+2
-1
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