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
38d46754
Commit
38d46754
authored
Dec 02, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize valid_dependency method by ayufan thought
parent
fba38b51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
app/models/ci/build.rb
app/models/ci/build.rb
+11
-15
No files found.
app/models/ci/build.rb
View file @
38d46754
...
@@ -143,7 +143,7 @@ module Ci
...
@@ -143,7 +143,7 @@ module Ci
end
end
before_transition
any
=>
[
:running
]
do
|
build
|
before_transition
any
=>
[
:running
]
do
|
build
|
build
.
validates_dependencies!
build
.
validates_dependencies!
if
Feature
.
enabled?
(
'ci_validates_dependencies'
)
end
end
end
end
...
@@ -485,20 +485,8 @@ module Ci
...
@@ -485,20 +485,8 @@ module Ci
end
end
def
validates_dependencies!
def
validates_dependencies!
return
unless
Feature
.
enabled?
(
'ci_validates_dependencies'
)
dependencies
.
each
do
|
dependency
|
raise
MissingDependenciesError
unless
dependency
.
valid_dependency?
dependencies
.
tap
do
|
deps
|
# When `dependencies` keyword is given and depended jobs are skipped by `only` keyword
if
options
[
:dependencies
]
&
.
any?
&&
deps
.
empty?
raise
MissingDependenciesError
end
# When artifacts of depended jobs have not existsed
deps
.
each
do
|
dep
|
if
dep
.
options
[
:artifacts
]
&
.
any?
&&
!
dep
.
artifacts?
raise
MissingDependenciesError
end
end
end
end
end
end
...
@@ -612,5 +600,13 @@ module Ci
...
@@ -612,5 +600,13 @@ module Ci
update_project_statistics
update_project_statistics
end
end
end
end
def
valid_dependency?
return
false
unless
complete?
return
false
if
artifacts_expired?
return
false
if
erased?
true
end
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