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
b668969c
Commit
b668969c
authored
Mar 22, 2022
by
Marius Bobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup secret variables refactoring in variables builder
Changelog: other
parent
554e3e67
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
123 additions
and
194 deletions
+123
-194
config/feature_flags/development/ci_variables_builder_memoize_secret_variables.yml
...lopment/ci_variables_builder_memoize_secret_variables.yml
+0
-8
lib/gitlab/ci/variables/builder.rb
lib/gitlab/ci/variables/builder.rb
+14
-40
spec/lib/gitlab/ci/variables/builder_spec.rb
spec/lib/gitlab/ci/variables/builder_spec.rb
+109
-146
No files found.
config/feature_flags/development/ci_variables_builder_memoize_secret_variables.yml
deleted
100644 → 0
View file @
554e3e67
---
name
:
ci_variables_builder_memoize_secret_variables
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/79850
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/351995
milestone
:
'
14.8'
type
:
development
group
:
group::pipeline execution
default_enabled
:
false
lib/gitlab/ci/variables/builder.rb
View file @
b668969c
...
@@ -24,8 +24,8 @@ module Gitlab
...
@@ -24,8 +24,8 @@ module Gitlab
variables
.
concat
(
user_variables
(
job
.
user
))
variables
.
concat
(
user_variables
(
job
.
user
))
variables
.
concat
(
job
.
dependency_variables
)
if
dependencies
variables
.
concat
(
job
.
dependency_variables
)
if
dependencies
variables
.
concat
(
secret_instance_variables
)
variables
.
concat
(
secret_instance_variables
)
variables
.
concat
(
secret_group_variables
(
environment:
environment
,
ref:
job
.
git_ref
))
variables
.
concat
(
secret_group_variables
(
environment:
environment
))
variables
.
concat
(
secret_project_variables
(
environment:
environment
,
ref:
job
.
git_ref
))
variables
.
concat
(
secret_project_variables
(
environment:
environment
))
variables
.
concat
(
job
.
trigger_request
.
user_variables
)
if
job
.
trigger_request
variables
.
concat
(
job
.
trigger_request
.
user_variables
)
if
job
.
trigger_request
variables
.
concat
(
pipeline
.
variables
)
variables
.
concat
(
pipeline
.
variables
)
variables
.
concat
(
pipeline
.
pipeline_schedule
.
job_variables
)
if
pipeline
.
pipeline_schedule
variables
.
concat
(
pipeline
.
pipeline_schedule
.
job_variables
)
if
pipeline
.
pipeline_schedule
...
@@ -75,21 +75,21 @@ module Gitlab
...
@@ -75,21 +75,21 @@ module Gitlab
end
end
end
end
def
secret_group_variables
(
environment
:,
ref
:)
def
secret_group_variables
(
environment
:)
if
memoize_secret_variables?
strong_memoize_with
(
:secret_group_variables
,
environment
)
do
memoized_secret_group_variables
(
environment:
environment
)
group_variables_builder
else
.
secret_variables
(
return
[]
unless
project
.
group
environment:
environment
,
protected_ref:
protected_ref?
)
project
.
group
.
ci_variables_for
(
ref
,
project
,
environment:
environment
)
end
end
end
end
def
secret_project_variables
(
environment
:,
ref
:)
def
secret_project_variables
(
environment
:)
if
memoize_secret_variables?
strong_memoize_with
(
:secret_project_variables
,
environment
)
do
memoized_secret_project_variables
(
environment:
environment
)
project_variables_builder
else
.
secret_variables
(
project
.
ci_variables_for
(
ref:
ref
,
environment:
environment
)
environment:
environment
,
protected_ref:
protected_ref?
)
end
end
end
end
...
@@ -120,24 +120,6 @@ module Gitlab
...
@@ -120,24 +120,6 @@ module Gitlab
end
end
end
end
def
memoized_secret_project_variables
(
environment
:)
strong_memoize_with
(
:secret_project_variables
,
environment
)
do
project_variables_builder
.
secret_variables
(
environment:
environment
,
protected_ref:
protected_ref?
)
end
end
def
memoized_secret_group_variables
(
environment
:)
strong_memoize_with
(
:secret_group_variables
,
environment
)
do
group_variables_builder
.
secret_variables
(
environment:
environment
,
protected_ref:
protected_ref?
)
end
end
def
ci_node_total_value
(
job
)
def
ci_node_total_value
(
job
)
parallel
=
job
.
options
&
.
dig
(
:parallel
)
parallel
=
job
.
options
&
.
dig
(
:parallel
)
parallel
=
parallel
.
dig
(
:total
)
if
parallel
.
is_a?
(
Hash
)
parallel
=
parallel
.
dig
(
:total
)
if
parallel
.
is_a?
(
Hash
)
...
@@ -150,14 +132,6 @@ module Gitlab
...
@@ -150,14 +132,6 @@ module Gitlab
end
end
end
end
def
memoize_secret_variables?
strong_memoize
(
:memoize_secret_variables
)
do
::
Feature
.
enabled?
(
:ci_variables_builder_memoize_secret_variables
,
project
,
default_enabled: :yaml
)
end
end
def
strong_memoize_with
(
name
,
*
args
)
def
strong_memoize_with
(
name
,
*
args
)
container
=
strong_memoize
(
name
)
{
{}
}
container
=
strong_memoize
(
name
)
{
{}
}
...
...
spec/lib/gitlab/ci/variables/builder_spec.rb
View file @
b668969c
This diff is collapsed.
Click to expand it.
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