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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
8efa041a
Commit
8efa041a
authored
Oct 13, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not process build success if project was removed
parent
03a8ed97
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
app/workers/build_success_worker.rb
app/workers/build_success_worker.rb
+4
-2
spec/workers/build_success_worker_spec.rb
spec/workers/build_success_worker_spec.rb
+11
-0
No files found.
app/workers/build_success_worker.rb
View file @
8efa041a
...
@@ -4,13 +4,15 @@ class BuildSuccessWorker
...
@@ -4,13 +4,15 @@ class BuildSuccessWorker
def
perform
(
build_id
)
def
perform
(
build_id
)
Ci
::
Build
.
find_by
(
id:
build_id
).
try
do
|
build
|
Ci
::
Build
.
find_by
(
id:
build_id
).
try
do
|
build
|
perform_deloyment
(
build
)
return
unless
build
.
project
create_deloyment
(
build
)
end
end
end
end
private
private
def
perform
_deloyment
(
build
)
def
create
_deloyment
(
build
)
return
if
build
.
environment
.
blank?
return
if
build
.
environment
.
blank?
service
=
CreateDeploymentService
.
new
(
service
=
CreateDeploymentService
.
new
(
...
...
spec/workers/build_success_worker_spec.rb
View file @
8efa041a
...
@@ -13,6 +13,17 @@ describe BuildSuccessWorker do
...
@@ -13,6 +13,17 @@ describe BuildSuccessWorker do
described_class
.
new
.
perform
(
build
.
id
)
described_class
.
new
.
perform
(
build
.
id
)
end
end
end
end
context
'when build is not associated with project'
do
let!
(
:build
)
{
create
(
:ci_build
,
project:
nil
)
}
it
'does not create deployment'
do
expect_any_instance_of
(
CreateDeploymentService
)
.
not_to
receive
(
:execute
)
described_class
.
new
.
perform
(
build
.
id
)
end
end
end
end
context
'when build does not exist'
do
context
'when build does not exist'
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