diff options
author | Nick Thomas <nick@gitlab.com> | 2016-12-08 01:09:18 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2016-12-15 13:57:03 +0000 |
commit | 93a03cd92f6418fbeaf126c30c161ab40d377e94 (patch) | |
tree | 0f49cd51558b97b8674e72b200e7d9150562e00e /lib/gitlab/regex.rb | |
parent | 35a3e9183052bab847c30203f27fea9cf77901a4 (diff) | |
download | gitlab-ce-93a03cd92f6418fbeaf126c30c161ab40d377e94.tar.gz |
Add an environment slug
Diffstat (limited to 'lib/gitlab/regex.rb')
-rw-r--r-- | lib/gitlab/regex.rb | 9 |
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 |