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
cacedf0f
Commit
cacedf0f
authored
Dec 06, 2021
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up clone_job_variables_at_job_retry
Changelog: changed
parent
39460c1a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
36 deletions
+6
-36
app/services/ci/retry_build_service.rb
app/services/ci/retry_build_service.rb
+2
-8
config/feature_flags/development/clone_job_variables_at_job_retry.yml
...re_flags/development/clone_job_variables_at_job_retry.yml
+0
-8
spec/services/ci/retry_build_service_spec.rb
spec/services/ci/retry_build_service_spec.rb
+4
-20
No files found.
app/services/ci/retry_build_service.rb
View file @
cacedf0f
...
@@ -7,7 +7,7 @@ module Ci
...
@@ -7,7 +7,7 @@ module Ci
allow_failure stage stage_id stage_idx trigger_request
allow_failure stage stage_id stage_idx trigger_request
yaml_variables when environment coverage_regex
yaml_variables when environment coverage_regex
description tag_list protected needs_attributes
description tag_list protected needs_attributes
resource_group scheduling_type]
.
freeze
job_variables_attributes
resource_group scheduling_type]
.
freeze
end
end
def
self
.
extra_accessors
def
self
.
extra_accessors
...
@@ -68,13 +68,7 @@ module Ci
...
@@ -68,13 +68,7 @@ module Ci
end
end
def
build_attributes
(
build
)
def
build_attributes
(
build
)
clone_attributes
=
if
::
Feature
.
enabled?
(
:clone_job_variables_at_job_retry
,
build
.
project
,
default_enabled: :yaml
)
attributes
=
self
.
class
.
clone_accessors
.
to_h
do
|
attribute
|
self
.
class
.
clone_accessors
+
[
:job_variables_attributes
]
else
self
.
class
.
clone_accessors
end
attributes
=
clone_attributes
.
to_h
do
|
attribute
|
[
attribute
,
build
.
public_send
(
attribute
)]
# rubocop:disable GitlabSecurity/PublicSend
[
attribute
,
build
.
public_send
(
attribute
)]
# rubocop:disable GitlabSecurity/PublicSend
end
end
...
...
config/feature_flags/development/clone_job_variables_at_job_retry.yml
deleted
100644 → 0
View file @
39460c1a
---
name
:
clone_job_variables_at_job_retry
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75720
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/347156
milestone
:
'
14.6'
type
:
development
group
:
group::pipeline authoring
default_enabled
:
false
spec/services/ci/retry_build_service_spec.rb
View file @
cacedf0f
...
@@ -128,25 +128,9 @@ RSpec.describe Ci::RetryBuildService do
...
@@ -128,25 +128,9 @@ RSpec.describe Ci::RetryBuildService do
expect
(
new_build
.
needs
).
not_to
match
(
build
.
needs
)
expect
(
new_build
.
needs
).
not_to
match
(
build
.
needs
)
end
end
context
'when clone_job_variables_at_job_retry is enabled'
do
it
'clones only internal job variables'
do
before
do
expect
(
new_build
.
job_variables
.
count
).
to
eq
(
1
)
stub_feature_flags
(
clone_job_variables_at_job_retry:
true
)
expect
(
new_build
.
job_variables
).
to
contain_exactly
(
having_attributes
(
key:
internal_job_variable
.
key
,
value:
internal_job_variable
.
value
))
end
it
'clones only internal job variables'
do
expect
(
new_build
.
job_variables
.
count
).
to
eq
(
1
)
expect
(
new_build
.
job_variables
).
to
contain_exactly
(
having_attributes
(
key:
internal_job_variable
.
key
,
value:
internal_job_variable
.
value
))
end
end
context
'when clone_job_variables_at_job_retry is not enabled'
do
before
do
stub_feature_flags
(
clone_job_variables_at_job_retry:
false
)
end
it
'does not clone internal job variables'
do
expect
(
new_build
.
job_variables
.
count
).
to
eq
(
0
)
end
end
end
end
end
...
@@ -170,7 +154,7 @@ RSpec.describe Ci::RetryBuildService do
...
@@ -170,7 +154,7 @@ RSpec.describe Ci::RetryBuildService do
Ci
::
Build
.
attribute_names
.
map
(
&
:to_sym
)
+
Ci
::
Build
.
attribute_names
.
map
(
&
:to_sym
)
+
Ci
::
Build
.
attribute_aliases
.
keys
.
map
(
&
:to_sym
)
+
Ci
::
Build
.
attribute_aliases
.
keys
.
map
(
&
:to_sym
)
+
Ci
::
Build
.
reflect_on_all_associations
.
map
(
&
:name
)
+
Ci
::
Build
.
reflect_on_all_associations
.
map
(
&
:name
)
+
[
:tag_list
,
:needs_attributes
]
-
[
:tag_list
,
:needs_attributes
,
:job_variables_attributes
]
-
# ee-specific accessors should be tested in ee/spec/services/ci/retry_build_service_spec.rb instead
# ee-specific accessors should be tested in ee/spec/services/ci/retry_build_service_spec.rb instead
described_class
.
extra_accessors
-
described_class
.
extra_accessors
-
[
:dast_site_profiles_build
,
:dast_scanner_profiles_build
]
# join tables
[
:dast_site_profiles_build
,
:dast_scanner_profiles_build
]
# join tables
...
...
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