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
Jérome Perrin
gitlab-ce
Commits
8c59489c
Commit
8c59489c
authored
Mar 27, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not retry jobs multiple times when retrying a pipeline
parent
c848735d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
app/services/ci/retry_pipeline_service.rb
app/services/ci/retry_pipeline_service.rb
+2
-2
spec/services/ci/retry_pipeline_service_spec.rb
spec/services/ci/retry_pipeline_service_spec.rb
+13
-0
No files found.
app/services/ci/retry_pipeline_service.rb
View file @
8c59489c
...
@@ -7,14 +7,14 @@ module Ci
...
@@ -7,14 +7,14 @@ module Ci
raise
Gitlab
::
Access
::
AccessDeniedError
raise
Gitlab
::
Access
::
AccessDeniedError
end
end
pipeline
.
builds
.
failed_or_canceled
.
find_each
do
|
build
|
pipeline
.
builds
.
latest
.
failed_or_canceled
.
find_each
do
|
build
|
next
unless
build
.
retryable?
next
unless
build
.
retryable?
Ci
::
RetryBuildService
.
new
(
project
,
current_user
)
Ci
::
RetryBuildService
.
new
(
project
,
current_user
)
.
reprocess
(
build
)
.
reprocess
(
build
)
end
end
pipeline
.
builds
.
skipped
.
find_each
do
|
skipped
|
pipeline
.
builds
.
latest
.
skipped
.
find_each
do
|
skipped
|
retry_optimistic_lock
(
skipped
)
{
|
build
|
build
.
process
}
retry_optimistic_lock
(
skipped
)
{
|
build
|
build
.
process
}
end
end
...
...
spec/services/ci/retry_pipeline_service_spec.rb
View file @
8c59489c
...
@@ -9,6 +9,19 @@ describe Ci::RetryPipelineService, '#execute', :services do
...
@@ -9,6 +9,19 @@ describe Ci::RetryPipelineService, '#execute', :services do
context
'when user has ability to modify pipeline'
do
context
'when user has ability to modify pipeline'
do
let
(
:user
)
{
create
(
:admin
)
}
let
(
:user
)
{
create
(
:admin
)
}
context
'when there are already retried jobs present'
do
before
do
create_build
(
'rspec'
,
:canceled
,
0
)
create_build
(
'rspec'
,
:failed
,
0
)
end
it
'does not retry jobs that has already been retried'
do
expect
(
statuses
.
first
).
to
be_retried
expect
{
service
.
execute
(
pipeline
)
}
.
to
change
{
CommitStatus
.
count
}.
by
(
1
)
end
end
context
'when there are failed builds in the last stage'
do
context
'when there are failed builds in the last stage'
do
before
do
before
do
create_build
(
'rspec 1'
,
:success
,
0
)
create_build
(
'rspec 1'
,
:success
,
0
)
...
...
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