diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-07-20 11:50:21 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-07-20 11:50:21 +0000 |
commit | 542b675cf60bb8208306d2c0cae138f4ccc47972 (patch) | |
tree | faa8dd2773bf6ce13c0cdb4b262f3b1b7172a7bb /lib | |
parent | 4766a77b1d44bb6989e6c86a7a7dd10f6983ba4e (diff) | |
parent | fe359ec760b104e6b1d5d1a5f87e8e954b18f8d9 (diff) | |
download | gitlab-ce-542b675cf60bb8208306d2c0cae138f4ccc47972.tar.gz |
Merge branch 'fix/gb/fix-container-registry-tag-routing' into 'master'
Fix docker tag reference routing constraints
Closes #35220 and gitlab-com/support-forum#2246
See merge request !12961
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/regex.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb index c1ee20b6977..1adc5ec952a 100644 --- a/lib/gitlab/regex.rb +++ b/lib/gitlab/regex.rb @@ -19,17 +19,23 @@ module Gitlab "It must start with letter, digit, emoji or '_'." end - def container_registry_reference_regex - Gitlab::PathRegex.git_reference_regex - end - ## - # Docker Distribution Registry 2.4.1 repository name rules + # Docker Distribution Registry repository / tag name rules + # + # See https://github.com/docker/distribution/blob/master/reference/regexp.go. # def container_repository_name_regex @container_repository_regex ||= %r{\A[a-z0-9]+(?:[-._/][a-z0-9]+)*\Z} end + ## + # We do not use regexp anchors here because these are not allowed when + # used as a routing constraint. + # + def container_registry_tag_regex + @container_registry_tag_regex ||= /[\w][\w.-]{0,127}/ + end + def environment_name_regex_chars 'a-zA-Z0-9_/\\$\\{\\}\\. -' end |