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
6c339026
Commit
6c339026
authored
Jul 20, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a problem with processing a pipeline where stage only has manual actions
parent
30f375cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
13 deletions
+16
-13
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+3
-2
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+13
-11
No files found.
app/models/ci/pipeline.rb
View file @
6c339026
...
@@ -212,8 +212,9 @@ module Ci
...
@@ -212,8 +212,9 @@ module Ci
# build builds only for the first stage that has builds available.
# build builds only for the first stage that has builds available.
#
#
stages
.
any?
do
|
stage
|
stages
.
any?
do
|
stage
|
CreateBuildsService
.
new
(
self
)
CreateBuildsService
.
new
(
self
).
.
execute
(
stage
,
user
,
status
,
trigger_request
).
present?
execute
(
stage
,
user
,
status
,
trigger_request
).
any?
(
&
:active?
)
end
end
end
end
...
...
spec/models/ci/pipeline_spec.rb
View file @
6c339026
...
@@ -264,7 +264,7 @@ describe Ci::Pipeline, models: true do
...
@@ -264,7 +264,7 @@ describe Ci::Pipeline, models: true do
context
'when listing manual actions'
do
context
'when listing manual actions'
do
let
(
:yaml
)
do
let
(
:yaml
)
do
{
{
stages:
[
"build"
,
"test"
,
"
test_failure"
,
"deploy
"
,
"cleanup"
],
stages:
[
"build"
,
"test"
,
"
staging"
,
"production
"
,
"cleanup"
],
build:
{
build:
{
stage:
"build"
,
stage:
"build"
,
script:
"BUILD"
,
script:
"BUILD"
,
...
@@ -273,17 +273,12 @@ describe Ci::Pipeline, models: true do
...
@@ -273,17 +273,12 @@ describe Ci::Pipeline, models: true do
stage:
"test"
,
stage:
"test"
,
script:
"TEST"
,
script:
"TEST"
,
},
},
test_failure:
{
staging:
{
stage:
"test_failure"
,
stage:
"staging"
,
script:
"ON test failure"
,
when:
"on_failure"
,
},
deploy:
{
stage:
"deploy"
,
script:
"PUBLISH"
,
script:
"PUBLISH"
,
},
},
production:
{
production:
{
stage:
"
deploy
"
,
stage:
"
production
"
,
script:
"PUBLISH"
,
script:
"PUBLISH"
,
when:
"manual"
,
when:
"manual"
,
},
},
...
@@ -311,11 +306,18 @@ describe Ci::Pipeline, models: true do
...
@@ -311,11 +306,18 @@ describe Ci::Pipeline, models: true do
# succeed stage test
# succeed stage test
pipeline
.
builds
.
running_or_pending
.
each
(
&
:success
)
pipeline
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
manual_actions
).
to
be_
one
# production
expect
(
manual_actions
).
to
be_
empty
# succeed stage
deploy
# succeed stage
staging and skip stage production
pipeline
.
builds
.
running_or_pending
.
each
(
&
:success
)
pipeline
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
manual_actions
).
to
be_many
# production and clear cache
expect
(
manual_actions
).
to
be_many
# production and clear cache
# succeed stage cleanup
pipeline
.
builds
.
running_or_pending
.
each
(
&
:success
)
# after processing a pipeline we should have 6 builds, 5 succeeded
expect
(
pipeline
.
builds
.
count
).
to
eq
(
6
)
expect
(
pipeline
.
builds
.
success
.
count
).
to
eq
(
4
)
end
end
def
manual_actions
def
manual_actions
...
...
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