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
a76cbe52
Commit
a76cbe52
authored
Jun 15, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add note for short circuit eval when building builds
parent
bf990fcd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+12
-2
No files found.
app/models/ci/pipeline.rb
View file @
a76cbe52
...
@@ -93,6 +93,11 @@ module Ci
...
@@ -93,6 +93,11 @@ module Ci
def
build_builds
(
user
,
trigger_request
=
nil
,
status
=
'success'
)
def
build_builds
(
user
,
trigger_request
=
nil
,
status
=
'success'
)
return
unless
config_processor
return
unless
config_processor
##
# Note that `Array#any?` implements a short circuit evaluation, so we
# build builds only for the first stage that has builds available.
#
config_processor
.
stages
.
any?
do
|
stage
|
config_processor
.
stages
.
any?
do
|
stage
|
build_builds_for_stage
(
stage
,
user
,
status
,
trigger_request
).
present?
build_builds_for_stage
(
stage
,
user
,
status
,
trigger_request
).
present?
end
end
...
@@ -117,9 +122,14 @@ module Ci
...
@@ -117,9 +122,14 @@ module Ci
prior_builds
=
latest_builds
.
where
.
not
(
stage:
next_stages
)
prior_builds
=
latest_builds
.
where
.
not
(
stage:
next_stages
)
prior_status
=
prior_builds
.
status
prior_status
=
prior_builds
.
status
# create builds for next stages based
##
# Create builds for next stages based.
#
# Note that there is a short circult evaluation here.
#
have_builds
=
next_stages
.
any?
do
|
stage
|
have_builds
=
next_stages
.
any?
do
|
stage
|
build_builds_for_stage
(
stage
,
build
.
user
,
prior_status
,
build
.
trigger_request
).
present?
build_builds_for_stage
(
stage
,
build
.
user
,
prior_status
,
build
.
trigger_request
).
present?
end
end
save!
if
have_builds
save!
if
have_builds
...
...
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