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
086f0351
Commit
086f0351
authored
Aug 22, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not fire synrchonous hooks when creating a job
Fire asynchronous hooks instead.
parent
6509833c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
app/models/ci/build.rb
app/models/ci/build.rb
+4
-1
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+10
-0
No files found.
app/models/ci/build.rb
View file @
086f0351
...
@@ -46,7 +46,10 @@ module Ci
...
@@ -46,7 +46,10 @@ module Ci
before_save
:ensure_token
before_save
:ensure_token
before_destroy
{
unscoped_project
}
before_destroy
{
unscoped_project
}
after_create
:execute_hooks
after_create
do
|
build
|
BuildHooksWorker
.
perform_async
(
build
.
id
)
end
after_commit
:update_project_statistics_after_save
,
on:
[
:create
,
:update
]
after_commit
:update_project_statistics_after_save
,
on:
[
:create
,
:update
]
after_commit
:update_project_statistics
,
on: :destroy
after_commit
:update_project_statistics
,
on: :destroy
...
...
spec/models/ci/build_spec.rb
View file @
086f0351
...
@@ -21,6 +21,16 @@ describe Ci::Build do
...
@@ -21,6 +21,16 @@ describe Ci::Build do
it
{
is_expected
.
to
respond_to
(
:has_trace?
)
}
it
{
is_expected
.
to
respond_to
(
:has_trace?
)
}
it
{
is_expected
.
to
respond_to
(
:trace
)
}
it
{
is_expected
.
to
respond_to
(
:trace
)
}
describe
'callbacks'
do
context
'when running after_create callback'
do
it
'triggers asynchronous build hooks worker'
do
expect
(
BuildHooksWorker
).
to
receive
(
:perform_async
)
create
(
:ci_build
)
end
end
end
describe
'.manual_actions'
do
describe
'.manual_actions'
do
let!
(
:manual_but_created
)
{
create
(
:ci_build
,
:manual
,
status: :created
,
pipeline:
pipeline
)
}
let!
(
:manual_but_created
)
{
create
(
:ci_build
,
:manual
,
status: :created
,
pipeline:
pipeline
)
}
let!
(
:manual_but_succeeded
)
{
create
(
:ci_build
,
:manual
,
status: :success
,
pipeline:
pipeline
)
}
let!
(
:manual_but_succeeded
)
{
create
(
:ci_build
,
:manual
,
status: :success
,
pipeline:
pipeline
)
}
...
...
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