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
891a4821
Commit
891a4821
authored
Nov 22, 2021
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy variables when retrying job
Changelog: changed
parent
44f0c50e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
app/models/ci/build.rb
app/models/ci/build.rb
+10
-0
app/services/ci/retry_build_service.rb
app/services/ci/retry_build_service.rb
+1
-1
spec/services/ci/retry_build_service_spec.rb
spec/services/ci/retry_build_service_spec.rb
+9
-1
No files found.
app/models/ci/build.rb
View file @
891a4821
...
...
@@ -1075,6 +1075,16 @@ module Ci
runner
&
.
instance_type?
end
def
job_variables_attributes
strong_memoize
(
:job_variables_attributes
)
do
job_variables
.
map
do
|
variable
|
variable
.
attributes
.
except
(
'id'
,
'job_id'
,
'encrypted_value'
,
'encrypted_value_iv'
).
tap
do
|
attrs
|
attrs
[
:value
]
=
variable
.
value
end
end
end
end
protected
def
run_status_commit_hooks!
...
...
app/services/ci/retry_build_service.rb
View file @
891a4821
...
...
@@ -7,7 +7,7 @@ module Ci
allow_failure stage stage_id stage_idx trigger_request
yaml_variables when environment coverage_regex
description tag_list protected needs_attributes
resource_group scheduling_type]
.
freeze
resource_group scheduling_type
job_variables_attributes
]
.
freeze
end
def
self
.
extra_accessors
...
...
spec/services/ci/retry_build_service_spec.rb
View file @
891a4821
...
...
@@ -125,6 +125,14 @@ RSpec.describe Ci::RetryBuildService do
expect
(
new_build
.
needs_attributes
).
to
match
(
build
.
needs_attributes
)
expect
(
new_build
.
needs
).
not_to
match
(
build
.
needs
)
end
it
'clones only the job variables attributes'
do
expect
(
new_build
.
job_variables
.
exists?
).
to
be_truthy
expect
(
build
.
job_variables
.
exists?
).
to
be_truthy
expect
(
new_build
.
job_variables_attributes
).
to
match
(
build
.
job_variables_attributes
)
expect
(
new_build
.
job_variables
).
not_to
match
(
build
.
job_variables
)
end
end
describe
'reject accessors'
do
...
...
@@ -147,7 +155,7 @@ RSpec.describe Ci::RetryBuildService do
Ci
::
Build
.
attribute_names
.
map
(
&
:to_sym
)
+
Ci
::
Build
.
attribute_aliases
.
keys
.
map
(
&
:to_sym
)
+
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
described_class
.
extra_accessors
-
[
: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