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
bae8fb72
Commit
bae8fb72
authored
Apr 01, 2021
by
Allison Browne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature flag async_add_build_failure_todo
Rollout:
https://gitlab.com/gitlab-org/gitlab/-/issues/326726
parent
b4ae184b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
7 deletions
+69
-7
app/models/commit_status.rb
app/models/commit_status.rb
+12
-0
app/workers/build_finished_worker.rb
app/workers/build_finished_worker.rb
+4
-1
config/feature_flags/development/async_add_build_failure_todo.yml
...eature_flags/development/async_add_build_failure_todo.yml
+8
-0
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+33
-6
spec/workers/build_finished_worker_spec.rb
spec/workers/build_finished_worker_spec.rb
+12
-0
No files found.
app/models/commit_status.rb
View file @
bae8fb72
...
...
@@ -179,6 +179,18 @@ class CommitStatus < ApplicationRecord
ExpireJobCacheWorker
.
perform_async
(
id
)
end
end
after_transition
any
=>
:failed
do
|
commit_status
|
next
if
Feature
.
enabled?
(
:async_add_build_failure_todo
,
commit_status
.
project
,
default_enabled: :yaml
)
next
unless
commit_status
.
project
# rubocop: disable CodeReuse/ServiceClass
commit_status
.
run_after_commit
do
MergeRequests
::
AddTodoWhenBuildFailsService
.
new
(
project
,
nil
).
execute
(
self
)
end
# rubocop: enable CodeReuse/ServiceClass
end
end
def
self
.
names
...
...
app/workers/build_finished_worker.rb
View file @
bae8fb72
...
...
@@ -36,7 +36,10 @@ class BuildFinishedWorker # rubocop:disable Scalability/IdempotentWorker
BuildHooksWorker
.
perform_async
(
build
.
id
)
ExpirePipelineCacheWorker
.
perform_async
(
build
.
pipeline_id
)
ChatNotificationWorker
.
perform_async
(
build
.
id
)
if
build
.
pipeline
.
chat?
::
Ci
::
MergeRequests
::
AddTodoWhenBuildFailsWorker
.
perform_async
(
build
.
id
)
if
build
.
failed?
if
build
.
failed?
&&
Feature
.
enabled?
(
:async_add_build_failure_todo
,
build
.
project
,
default_enabled: :yaml
)
::
Ci
::
MergeRequests
::
AddTodoWhenBuildFailsWorker
.
perform_async
(
build
.
id
)
end
##
# We want to delay sending a build trace to object storage operation to
...
...
config/feature_flags/development/async_add_build_failure_todo.yml
0 → 100644
View file @
bae8fb72
---
name
:
async_add_build_failure_todo
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/57490/diffs
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/326726
milestone
:
'
13.11'
type
:
development
group
:
group::continuous integration
default_enabled
:
false
spec/models/ci/build_spec.rb
View file @
bae8fb72
...
...
@@ -3670,15 +3670,42 @@ RSpec.describe Ci::Build do
subject
.
drop!
end
it
'creates a todo'
,
:sidekiq_inline
do
project
.
add_developer
(
user
)
context
'when async_add_build_failure_todo flag enabled'
do
it
'creates a todo async'
,
:sidekiq_inline
do
project
.
add_developer
(
user
)
expect_next_instance_of
(
TodoService
)
do
|
todo_service
|
expect
(
todo_service
)
.
to
receive
(
:merge_request_build_failed
).
with
(
merge_request
)
end
expect_next_instance_of
(
TodoService
)
do
|
todo_service
|
expect
(
todo_service
)
.
to
receive
(
:merge_request_build_failed
).
with
(
merge_request
)
subject
.
drop!
end
subject
.
drop!
it
'does not create a sync todo'
do
project
.
add_developer
(
user
)
expect
(
TodoService
).
not_to
receive
(
:new
)
subject
.
drop!
end
end
context
'when async_add_build_failure_todo flag disabled'
do
before
do
stub_feature_flags
(
async_add_build_failure_todo:
false
)
end
it
'creates a todo sync'
do
project
.
add_developer
(
user
)
expect_next_instance_of
(
TodoService
)
do
|
todo_service
|
expect
(
todo_service
)
.
to
receive
(
:merge_request_build_failed
).
with
(
merge_request
)
end
subject
.
drop!
end
end
end
...
...
spec/workers/build_finished_worker_spec.rb
View file @
bae8fb72
...
...
@@ -39,6 +39,18 @@ RSpec.describe BuildFinishedWorker do
subject
end
context
'when async_add_build_failure_todo disabled'
do
before
do
stub_feature_flags
(
async_add_build_failure_todo:
false
)
end
it
'does not add a todo'
do
expect
(
::
Ci
::
MergeRequests
::
AddTodoWhenBuildFailsWorker
).
not_to
receive
(
:perform_async
)
subject
end
end
end
context
'when build has a chat'
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