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
Léo-Paul Géneau
gitlab-ce
Commits
a6176190
Commit
a6176190
authored
Mar 19, 2018
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent auto-retry AccessDenied error from stopping transition to failed
parent
ea5221ae
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
app/models/ci/build.rb
app/models/ci/build.rb
+5
-1
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+29
-0
No files found.
app/models/ci/build.rb
View file @
a6176190
...
...
@@ -140,7 +140,11 @@ module Ci
next
if
build
.
retries_max
.
zero?
if
build
.
retries_count
<
build
.
retries_max
begin
Ci
::
Build
.
retry
(
build
,
build
.
user
)
rescue
Gitlab
::
Access
::
AccessDeniedError
=>
ex
Rails
.
logger
.
error
"Unable to auto-retry job
#{
build
.
id
}
:
#{
ex
}
"
end
end
end
...
...
spec/models/ci/build_spec.rb
View file @
a6176190
...
...
@@ -2065,6 +2065,35 @@ describe Ci::Build do
subject
.
drop!
end
context
'when retry service raises Gitlab::Access::AccessDeniedError exception'
do
let
(
:retry_service
)
{
Ci
::
RetryBuildService
.
new
(
subject
.
project
,
subject
.
user
)
}
before
do
allow_any_instance_of
(
Ci
::
RetryBuildService
)
.
to
receive
(
:execute
)
.
with
(
subject
)
.
and_raise
(
Gitlab
::
Access
::
AccessDeniedError
)
allow
(
Rails
.
logger
).
to
receive
(
:error
)
end
it
'handles raised exception'
do
expect
{
subject
.
drop!
}.
not_to
raise_exception
(
Gitlab
::
Access
::
AccessDeniedError
)
end
it
'logs the error'
do
subject
.
drop!
expect
(
Rails
.
logger
)
.
to
have_received
(
:error
)
.
with
(
a_string_matching
(
"Unable to auto-retry job
#{
subject
.
id
}
"
))
end
it
'fails the job'
do
subject
.
drop!
expect
(
subject
.
failed?
).
to
be_truthy
end
end
end
context
'when build is not configured to be retried'
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