Commit eb2966fa authored by Grzegorz Bizon's avatar Grzegorz Bizon

Move ref slug helper to HasRef module

parent dc7d0249
...@@ -5,6 +5,7 @@ module Ci ...@@ -5,6 +5,7 @@ module Ci
include Ci::Processable include Ci::Processable
include Importable include Importable
include AfterCommitQueue include AfterCommitQueue
include HasRef
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
belongs_to :project belongs_to :project
......
...@@ -398,17 +398,6 @@ module Ci ...@@ -398,17 +398,6 @@ module Ci
options&.dig(:environment, :on_stop) options&.dig(:environment, :on_stop)
end end
# A slugified version of the build ref, suitable for inclusion in URLs and
# domain names. Rules:
#
# * Lowercased
# * Anything not matching [a-z0-9-] is replaced with a -
# * Maximum length is 63 bytes
# * First/Last Character is not a hyphen
def ref_slug
Gitlab::Utils.slugify(ref.to_s)
end
## ##
# Variables in the environment name scope. # Variables in the environment name scope.
# #
......
...@@ -14,4 +14,15 @@ module HasRef ...@@ -14,4 +14,15 @@ module HasRef
Gitlab::Git::TAG_REF_PREFIX + ref.to_s Gitlab::Git::TAG_REF_PREFIX + ref.to_s
end end
end end
# A slugified version of the build ref, suitable for inclusion in URLs and
# domain names. Rules:
#
# * Lowercased
# * Anything not matching [a-z0-9-] is replaced with a -
# * Maximum length is 63 bytes
# * First/Last Character is not a hyphen
def ref_slug
Gitlab::Utils.slugify(ref.to_s)
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment