summaryrefslogtreecommitdiff
path: root/lib/gitlab/regex.rb
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2016-12-08 01:09:18 +0000
committerNick Thomas <nick@gitlab.com>2016-12-15 13:57:03 +0000
commit93a03cd92f6418fbeaf126c30c161ab40d377e94 (patch)
tree0f49cd51558b97b8674e72b200e7d9150562e00e /lib/gitlab/regex.rb
parent35a3e9183052bab847c30203f27fea9cf77901a4 (diff)
downloadgitlab-ce-93a03cd92f6418fbeaf126c30c161ab40d377e94.tar.gz
Add an environment slug
Diffstat (limited to 'lib/gitlab/regex.rb')
-rw-r--r--lib/gitlab/regex.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index 7c711d581e8..9e0b0e5ea98 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -131,5 +131,14 @@ module Gitlab
def kubernetes_namespace_regex_message
"can contain only letters, digits or '-', and cannot start or end with '-'"
end
+
+ def environment_slug_regex
+ @environment_slug_regex ||= /\A[a-z]([a-z0-9-]*[a-z0-9])?\z/.freeze
+ end
+
+ def environment_slug_regex_message
+ "can contain only lowercase letters, digits, and '-'. " \
+ "Must start with a letter, and cannot end with '-'"
+ end
end
end