Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
91969f54
Commit
91969f54
authored
Jun 23, 2020
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moves CIVariablesHelper to CI namespace
parent
d9a1e681
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
52 deletions
+54
-52
app/helpers/ci/variables_helper.rb
app/helpers/ci/variables_helper.rb
+54
-0
app/helpers/ci_variables_helper.rb
app/helpers/ci_variables_helper.rb
+0
-52
No files found.
app/helpers/ci/variables_helper.rb
0 → 100644
View file @
91969f54
# frozen_string_literal: true
module
Ci
module
VariablesHelper
def
ci_variable_protected_by_default?
Gitlab
::
CurrentSettings
.
current_application_settings
.
protected_ci_variables
end
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
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
def
ci_variable_protected?
(
variable
,
only_key_value
)
if
variable
&&
!
only_key_value
variable
.
protected
else
ci_variable_protected_by_default?
end
end
def
ci_variable_masked?
(
variable
,
only_key_value
)
if
variable
&&
!
only_key_value
variable
.
masked
else
false
end
end
def
ci_variable_type_options
[
%w(Variable env_var)
,
%w(File file)
]
end
def
ci_variable_maskable_regex
Ci
::
Maskable
::
REGEX
.
inspect
.
sub
(
'\\A'
,
'^'
).
sub
(
'\\z'
,
'$'
).
sub
(
/^\//
,
''
).
sub
(
/\/[a-z]*$/
,
''
).
gsub
(
'\/'
,
'/'
)
end
end
end
app/helpers/ci_variables_helper.rb
deleted
100644 → 0
View file @
d9a1e681
# frozen_string_literal: true
module
CiVariablesHelper
def
ci_variable_protected_by_default?
Gitlab
::
CurrentSettings
.
current_application_settings
.
protected_ci_variables
end
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
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
def
ci_variable_protected?
(
variable
,
only_key_value
)
if
variable
&&
!
only_key_value
variable
.
protected
else
ci_variable_protected_by_default?
end
end
def
ci_variable_masked?
(
variable
,
only_key_value
)
if
variable
&&
!
only_key_value
variable
.
masked
else
false
end
end
def
ci_variable_type_options
[
%w(Variable env_var)
,
%w(File file)
]
end
def
ci_variable_maskable_regex
Ci
::
Maskable
::
REGEX
.
inspect
.
sub
(
'\\A'
,
'^'
).
sub
(
'\\z'
,
'$'
).
sub
(
/^\//
,
''
).
sub
(
/\/[a-z]*$/
,
''
).
gsub
(
'\/'
,
'/'
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment