Module: Ci::VariablesHelper
- Defined in:
- app/helpers/ci/variables_helper.rb
Instance Method Summary collapse
- #ci_variable_maskable_raw_regex ⇒ Object
- #ci_variable_maskable_regex ⇒ Object
- #ci_variable_masked?(variable, only_key_value) ⇒ Boolean
- #ci_variable_protected?(variable, only_key_value) ⇒ Boolean
- #ci_variable_protected_by_default? ⇒ Boolean
- #ci_variable_type_options ⇒ Object
- #create_deploy_token_path(entity, opts = {}) ⇒ Object
- #revoke_deploy_token_path(entity, token) ⇒ Object
Instance Method Details
#ci_variable_maskable_raw_regex ⇒ Object
50 51 52 |
# File 'app/helpers/ci/variables_helper.rb', line 50 def ci_variable_maskable_raw_regex Ci::Maskable::MASK_AND_RAW_REGEX.inspect.sub('\\A', '^').sub('\\z', '$')[1...-1] end |
#ci_variable_maskable_regex ⇒ Object
54 55 56 |
# File 'app/helpers/ci/variables_helper.rb', line 54 def ci_variable_maskable_regex Ci::Maskable::REGEX.inspect.sub('\\A', '^').sub('\\z', '$').sub(%r{^/}, '').sub(%r{/[a-z]*$}, '').gsub('\/', '/') end |
#ci_variable_masked?(variable, only_key_value) ⇒ Boolean
35 36 37 38 39 40 41 |
# File 'app/helpers/ci/variables_helper.rb', line 35 def ci_variable_masked?(variable, only_key_value) if variable && !only_key_value variable.masked else false end end |
#ci_variable_protected?(variable, only_key_value) ⇒ Boolean
27 28 29 30 31 32 33 |
# File 'app/helpers/ci/variables_helper.rb', line 27 def ci_variable_protected?(variable, only_key_value) if variable && !only_key_value variable.protected else ci_variable_protected_by_default? end end |
#ci_variable_protected_by_default? ⇒ Boolean
5 6 7 |
# File 'app/helpers/ci/variables_helper.rb', line 5 def ci_variable_protected_by_default? Gitlab::CurrentSettings.current_application_settings.protected_ci_variables end |
#ci_variable_type_options ⇒ Object
43 44 45 46 47 48 |
# File 'app/helpers/ci/variables_helper.rb', line 43 def [ %w[Variable env_var], %w[File file] ] end |
#create_deploy_token_path(entity, opts = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'app/helpers/ci/variables_helper.rb', line 9 def create_deploy_token_path(entity, opts = {}) if entity.is_a?(::Group) create_deploy_token_group_settings_repository_path(entity, opts) else # TODO: change this path to 'create_deploy_token_project_settings_ci_cd_path' # See MR comment for more detail: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27059#note_311585356 create_deploy_token_project_settings_repository_path(entity, opts) end end |
#revoke_deploy_token_path(entity, token) ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/helpers/ci/variables_helper.rb', line 19 def revoke_deploy_token_path(entity, token) if entity.is_a?(::Group) revoke_group_deploy_token_path(entity, token) else revoke_project_deploy_token_path(entity, token) end end |