debian-mirror-gitlab/app/helpers/ci_variables_helper.rb

35 lines
760 B
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
module CiVariablesHelper
def ci_variable_protected_by_default?
Gitlab::CurrentSettings.current_application_settings.protected_ci_variables
end
def ci_variable_protected?(variable, only_key_value)
if variable && !only_key_value
variable.protected
else
ci_variable_protected_by_default?
end
end
2019-07-07 11:18:12 +05:30
def ci_variable_masked?(variable, only_key_value)
if variable && !only_key_value
variable.masked
else
2019-09-04 21:01:54 +05:30
false
2019-07-07 11:18:12 +05:30
end
end
2019-07-31 22:56:46 +05:30
def ci_variable_type_options
[
%w(Variable env_var),
%w(File file)
]
end
2019-09-04 21:01:54 +05:30
def ci_variable_maskable_regex
Maskable::REGEX.inspect.sub('\\A', '^').sub('\\z', '$').sub(/^\//, '').sub(/\/[a-z]*$/, '').gsub('\/', '/')
end
2019-02-15 15:39:39 +05:30
end