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
d87132b4
Commit
d87132b4
authored
Mar 03, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always actionize build when it is a manual action
Do not skip manual actions even if actions are optional.
parent
53fcede5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
28 deletions
+51
-28
app/services/ci/process_pipeline_service.rb
app/services/ci/process_pipeline_service.rb
+3
-4
spec/services/ci/process_pipeline_service_spec.rb
spec/services/ci/process_pipeline_service_spec.rb
+48
-24
No files found.
app/services/ci/process_pipeline_service.rb
View file @
d87132b4
...
...
@@ -35,11 +35,8 @@ module Ci
def
process_build
(
build
,
current_status
)
if
valid_statuses_for_when
(
build
.
when
).
include?
(
current_status
)
build
.
enqueue
build
.
action?
?
build
.
actionize
:
build
.
enqueue
true
elsif
build
.
action?
&&
build
.
barrier?
build
.
actionize
false
else
build
.
skip
false
...
...
@@ -54,6 +51,8 @@ module Ci
%w[failed]
when
'always'
%w[success failed skipped]
when
'manual'
%w[success]
else
[]
end
...
...
spec/services/ci/process_pipeline_service_spec.rb
View file @
d87132b4
...
...
@@ -73,7 +73,7 @@ describe Ci::ProcessPipelineService, '#execute', :services do
create_build
(
'deploy'
,
stage_idx:
3
)
create_build
(
'production'
,
stage_idx:
3
,
when:
'manual'
,
allow_failure:
true
)
create_build
(
'cleanup'
,
stage_idx:
4
,
when:
'always'
)
create_build
(
'clear
cache'
,
stage_idx:
4
,
when:
'manual'
,
allow_failure:
true
)
create_build
(
'clear
:
cache'
,
stage_idx:
4
,
when:
'manual'
,
allow_failure:
true
)
end
context
'when builds are successful'
do
...
...
@@ -89,17 +89,17 @@ describe Ci::ProcessPipelineService, '#execute', :services do
succeed_running_or_pending
expect
(
builds_names
).
to
eq
%w(build test deploy)
expect
(
builds_statuses
).
to
eq
%w(success success pending)
expect
(
builds_names
).
to
eq
%w(build test deploy
production
)
expect
(
builds_statuses
).
to
eq
%w(success success pending
manual
)
succeed_running_or_pending
expect
(
builds_names
).
to
eq
%w(build test deploy
cleanup
)
expect
(
builds_statuses
).
to
eq
%w(success success success
pending
)
expect
(
builds_names
).
to
eq
%w(build test deploy
production cleanup clear:cache
)
expect
(
builds_statuses
).
to
eq
%w(success success success
manual pending manual
)
succeed_running_or_pending
expect
(
builds_statuses
).
to
eq
%w(success success success
success
)
expect
(
builds_statuses
).
to
eq
%w(success success success
manual success manual
)
expect
(
pipeline
.
reload
.
status
).
to
eq
'success'
end
end
...
...
@@ -174,18 +174,18 @@ describe Ci::ProcessPipelineService, '#execute', :services do
succeed_running_or_pending
expect
(
builds_names
).
to
eq
%w(build test deploy)
expect
(
builds_statuses
).
to
eq
%w(success success pending)
expect
(
builds_names
).
to
eq
%w(build test deploy
production
)
expect
(
builds_statuses
).
to
eq
%w(success success pending
manual
)
fail_running_or_pending
expect
(
builds_names
).
to
eq
%w(build test deploy cleanup)
expect
(
builds_statuses
).
to
eq
%w(success success failed pending)
expect
(
builds_names
).
to
eq
%w(build test deploy
production
cleanup)
expect
(
builds_statuses
).
to
eq
%w(success success failed
manual
pending)
succeed_running_or_pending
expect
(
builds_statuses
).
to
eq
%w(success success failed success)
expect
(
pipeline
.
reload
.
status
).
to
eq
(
'failed'
)
expect
(
builds_statuses
).
to
eq
%w(success success failed
manual
success)
expect
(
pipeline
.
reload
).
to
be_failed
end
end
...
...
@@ -204,7 +204,9 @@ describe Ci::ProcessPipelineService, '#execute', :services do
cancel_running_or_pending
expect
(
builds
.
running_or_pending
).
to
be_empty
expect
(
pipeline
.
reload
.
status
).
to
eq
'canceled'
expect
(
builds_names
).
to
eq
%w[build test]
expect
(
builds_statuses
).
to
eq
%w[success canceled]
expect
(
pipeline
.
reload
).
to
be_canceled
end
end
...
...
@@ -243,7 +245,7 @@ describe Ci::ProcessPipelineService, '#execute', :services do
end
it
'starts from the second stage'
do
expect
(
all_builds_statuses
).
to
eq
%w[
skipped
pending created]
expect
(
all_builds_statuses
).
to
eq
%w[
manual
pending created]
end
end
...
...
@@ -261,7 +263,7 @@ describe Ci::ProcessPipelineService, '#execute', :services do
builds
.
first
.
success
expect
(
all_builds_statuses
).
to
eq
(
%w[success
skipped
pending]
)
expect
(
all_builds_statuses
).
to
eq
(
%w[success
manual
pending]
)
end
end
end
...
...
@@ -275,6 +277,7 @@ describe Ci::ProcessPipelineService, '#execute', :services do
create_build
(
'production:test'
,
stage_idx:
4
,
when:
'always'
)
end
context
'when first stage succeeds'
do
it
'blocks pipeline on stage with first manual action'
do
process_pipeline
...
...
@@ -290,6 +293,27 @@ describe Ci::ProcessPipelineService, '#execute', :services do
end
end
context
'when first stage fails'
do
it
'does not take blocking action into account'
do
process_pipeline
expect
(
builds_names
).
to
eq
%w[code:test]
expect
(
builds_statuses
).
to
eq
%w[pending]
expect
(
pipeline
.
reload
.
status
).
to
eq
'pending'
fail_running_or_pending
expect
(
builds_names
).
to
eq
%w[code:test production:test]
expect
(
builds_statuses
).
to
eq
%w[failed pending]
succeed_running_or_pending
expect
(
builds_statuses
).
to
eq
%w[failed success]
expect
(
pipeline
.
reload
).
to
be_failed
end
end
end
context
'when second stage has only on_failure jobs'
do
before
do
create_build
(
'check'
,
stage_idx:
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