diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-25 00:10:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-25 00:10:17 +0300 |
commit | 39a4ea6124066f2209829899e6c1afe247304c91 (patch) | |
tree | a6a337abe741974ab90c8fb07787ef1e69f63108 /lib/gitlab | |
parent | 9b14160725d91f8824b35223f16bf073a97bf7de (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/metrics/dashboard/stages/custom_metrics_details_inserter.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/regex.rb | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/gitlab/metrics/dashboard/stages/custom_metrics_details_inserter.rb b/lib/gitlab/metrics/dashboard/stages/custom_metrics_details_inserter.rb index cfec027155e..06cfa5cc58e 100644 --- a/lib/gitlab/metrics/dashboard/stages/custom_metrics_details_inserter.rb +++ b/lib/gitlab/metrics/dashboard/stages/custom_metrics_details_inserter.rb @@ -27,7 +27,7 @@ module Gitlab private def custom_group_titles - @custom_group_titles ||= PrometheusMetricEnums.custom_group_details.values.map { |group_details| group_details[:group_title] } + @custom_group_titles ||= Enums::PrometheusMetric.custom_group_details.values.map { |group_details| group_details[:group_title] } end def edit_path(metric) diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb index 1e1e0d856b7..e070c2d2e84 100644 --- a/lib/gitlab/regex.rb +++ b/lib/gitlab/regex.rb @@ -51,6 +51,21 @@ module Gitlab maven_app_name_regex end + def pypi_version_regex + # See the official regex: https://github.com/pypa/packaging/blob/16.7/packaging/version.py#L159 + + @pypi_version_regex ||= %r{ + \A(?: + v? + (?:([0-9]+)!)? (?# epoch) + ([0-9]+(?:\.[0-9]+)*) (?# release segment) + ([-_\.]?((a|b|c|rc|alpha|beta|pre|preview))[-_\.]?([0-9]+)?)? (?# pre-release) + ((?:-([0-9]+))|(?:[-_\.]?(post|rev|r)[-_\.]?([0-9]+)?))? (?# post release) + ([-_\.]?(dev)[-_\.]?([0-9]+)?)? (?# dev release) + (?:\+([a-z0-9]+(?:[-_\.][a-z0-9]+)*))? (?# local version) + )\z}xi.freeze + end + def unbounded_semver_regex # See the official regex: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string |