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
4662edd6
Commit
4662edd6
authored
Dec 06, 2021
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
15f83db7
9bc2b098
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
3 deletions
+50
-3
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
+7
-1
config/feature_flags/development/clone_job_variables_at_job_retry.yml
...re_flags/development/clone_job_variables_at_job_retry.yml
+8
-0
scripts/review_apps/base-config.yaml
scripts/review_apps/base-config.yaml
+1
-1
spec/services/ci/retry_build_service_spec.rb
spec/services/ci/retry_build_service_spec.rb
+24
-1
No files found.
app/models/ci/build.rb
View file @
4662edd6
...
@@ -1083,6 +1083,16 @@ module Ci
...
@@ -1083,6 +1083,16 @@ module Ci
runner
&
.
instance_type?
runner
&
.
instance_type?
end
end
def
job_variables_attributes
strong_memoize
(
:job_variables_attributes
)
do
job_variables
.
internal_source
.
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
protected
def
run_status_commit_hooks!
def
run_status_commit_hooks!
...
...
app/services/ci/retry_build_service.rb
View file @
4662edd6
...
@@ -68,7 +68,13 @@ module Ci
...
@@ -68,7 +68,13 @@ module Ci
end
end
def
build_attributes
(
build
)
def
build_attributes
(
build
)
attributes
=
self
.
class
.
clone_accessors
.
to_h
do
|
attribute
|
clone_attributes
=
if
::
Feature
.
enabled?
(
:clone_job_variables_at_job_retry
,
build
.
project
,
default_enabled: :yaml
)
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
0 → 100644
View file @
4662edd6
---
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
scripts/review_apps/base-config.yaml
View file @
4662edd6
...
@@ -158,7 +158,7 @@ postgresql:
...
@@ -158,7 +158,7 @@ postgresql:
memory
:
1500M
memory
:
1500M
master
:
master
:
nodeSelector
:
nodeSelector
:
preemptible
:
"
tru
e"
preemptible
:
"
fals
e"
prometheus
:
prometheus
:
install
:
false
install
:
false
redis
:
redis
:
...
...
spec/services/ci/retry_build_service_spec.rb
View file @
4662edd6
...
@@ -73,6 +73,8 @@ RSpec.describe Ci::RetryBuildService do
...
@@ -73,6 +73,8 @@ RSpec.describe Ci::RetryBuildService do
scheduled_at:
10
.
seconds
.
since
)
scheduled_at:
10
.
seconds
.
since
)
end
end
let_it_be
(
:internal_job_variable
)
{
create
(
:ci_job_variable
,
job:
build
)
}
before_all
do
before_all
do
# Make sure that build has both `stage_id` and `stage` because FactoryBot
# Make sure that build has both `stage_id` and `stage` because FactoryBot
# can reset one of the fields when assigning another. We plan to deprecate
# can reset one of the fields when assigning another. We plan to deprecate
...
@@ -86,7 +88,7 @@ RSpec.describe Ci::RetryBuildService do
...
@@ -86,7 +88,7 @@ RSpec.describe Ci::RetryBuildService do
file_type:
file_type
,
job:
build
,
expire_at:
build
.
artifacts_expire_at
)
file_type:
file_type
,
job:
build
,
expire_at:
build
.
artifacts_expire_at
)
end
end
create
(
:ci_job_variable
,
job:
build
)
create
(
:ci_job_variable
,
:dotenv_source
,
job:
build
)
create
(
:ci_build_need
,
build:
build
)
create
(
:ci_build_need
,
build:
build
)
create
(
:terraform_state_version
,
build:
build
)
create
(
:terraform_state_version
,
build:
build
)
end
end
...
@@ -125,6 +127,27 @@ RSpec.describe Ci::RetryBuildService do
...
@@ -125,6 +127,27 @@ RSpec.describe Ci::RetryBuildService do
expect
(
new_build
.
needs_attributes
).
to
match
(
build
.
needs_attributes
)
expect
(
new_build
.
needs_attributes
).
to
match
(
build
.
needs_attributes
)
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
before
do
stub_feature_flags
(
clone_job_variables_at_job_retry:
true
)
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
describe
'reject accessors'
do
describe
'reject accessors'
do
...
...
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