diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-03 11:38:39 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-03 11:38:39 +0200 |
commit | 1a47986b3d7cd8e6d5bdbfbc20a841cf5586f773 (patch) | |
tree | 50d421d260f6ef1fb7d5d9f564494fe9d23d09bf /lib/gitlab/regex.rb | |
parent | 01280a5ad56f67ae653dade815faa5649bcee81f (diff) | |
download | gitlab-ce-1a47986b3d7cd8e6d5bdbfbc20a841cf5586f773.tar.gz |
Check registry repository name against regexp
This regexp is extracted from Docker Distribution 2.4.1 docs, contains
additional `/` element that can be a separator of components.
Diffstat (limited to 'lib/gitlab/regex.rb')
-rw-r--r-- | lib/gitlab/regex.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb index 5e5f5ff1589..e599dd4a656 100644 --- a/lib/gitlab/regex.rb +++ b/lib/gitlab/regex.rb @@ -121,6 +121,13 @@ module Gitlab git_reference_regex end + ## + # Docker Distribution Registry 2.4.1 repository name rules + # + def container_repository_name_regex + @container_repository_regex ||= %r{\A[a-z0-9]+(?:[-._/][a-z0-9]+)*\Z} + end + def environment_name_regex @environment_name_regex ||= /\A[a-zA-Z0-9_\\\/\${}. -]+\z/.freeze end |