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
d16eed3b
Commit
d16eed3b
authored
Feb 22, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix reprocessing skipped jobs when retrying pipeline
parent
5a84b5fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
app/services/ci/retry_pipeline_service.rb
app/services/ci/retry_pipeline_service.rb
+2
-0
spec/services/ci/retry_pipeline_service_spec.rb
spec/services/ci/retry_pipeline_service_spec.rb
+23
-2
No files found.
app/services/ci/retry_pipeline_service.rb
View file @
d16eed3b
...
@@ -8,6 +8,8 @@ module Ci
...
@@ -8,6 +8,8 @@ module Ci
pipeline
.
builds
.
failed_or_canceled
.
find_each
do
|
build
|
pipeline
.
builds
.
failed_or_canceled
.
find_each
do
|
build
|
next
unless
build
.
retryable?
next
unless
build
.
retryable?
pipeline
.
mark_as_processable_after_stage
(
build
.
stage_idx
)
Ci
::
RetryBuildService
.
new
(
project
,
current_user
)
Ci
::
RetryBuildService
.
new
(
project
,
current_user
)
.
reprocess
(
build
)
.
reprocess
(
build
)
end
end
...
...
spec/services/ci/retry_pipeline_service_spec.rb
View file @
d16eed3b
...
@@ -69,6 +69,25 @@ describe Ci::RetryPipelineService, '#execute', :services do
...
@@ -69,6 +69,25 @@ describe Ci::RetryPipelineService, '#execute', :services do
end
end
end
end
context
'when the last stage was skipepd'
do
before
do
create_build
(
'build 1'
,
:success
,
0
)
create_build
(
'test 2'
,
:failed
,
1
)
create_build
(
'report 3'
,
:skipped
,
2
)
create_build
(
'report 4'
,
:skipped
,
2
)
end
it
'retries builds only in the first stage'
do
service
.
execute
(
pipeline
)
expect
(
build
(
'build 1'
)).
to
be_success
expect
(
build
(
'test 2'
)).
to
be_pending
expect
(
build
(
'report 3'
)).
to
be_created
expect
(
build
(
'report 4'
)).
to
be_created
expect
(
pipeline
.
reload
).
to
be_running
end
end
context
'when pipeline contains manual actions'
do
context
'when pipeline contains manual actions'
do
context
'when there is a canceled manual action in first stage'
do
context
'when there is a canceled manual action in first stage'
do
before
do
before
do
...
@@ -90,14 +109,16 @@ describe Ci::RetryPipelineService, '#execute', :services do
...
@@ -90,14 +109,16 @@ describe Ci::RetryPipelineService, '#execute', :services do
context
'when there is a skipped manual action in last stage'
do
context
'when there is a skipped manual action in last stage'
do
before
do
before
do
create_build
(
'rspec 1'
,
:canceled
,
0
)
create_build
(
'rspec 1'
,
:canceled
,
0
)
create_build
(
'rspec 2'
,
:skipped
,
0
,
:manual
)
create_build
(
'staging'
,
:skipped
,
1
,
:manual
)
create_build
(
'staging'
,
:skipped
,
1
,
:manual
)
end
end
it
'retries canceled job and
skips manual action
'
do
it
'retries canceled job and
reprocesses manual actions
'
do
service
.
execute
(
pipeline
)
service
.
execute
(
pipeline
)
expect
(
build
(
'rspec 1'
)).
to
be_pending
expect
(
build
(
'rspec 1'
)).
to
be_pending
expect
(
build
(
'staging'
)).
to
be_skipped
expect
(
build
(
'rspec 2'
)).
to
be_skipped
expect
(
build
(
'staging'
)).
to
be_created
expect
(
pipeline
.
reload
).
to
be_running
expect
(
pipeline
.
reload
).
to
be_running
end
end
end
end
...
...
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