summaryrefslogtreecommitdiff
path: root/app/models/ci/build.rb
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-09-05 22:37:28 +0900
committerShinya Maeda <shinya@gitlab.com>2017-12-06 15:53:59 +0900
commitc3e0731d2efc777018b668d9e0b7f8aa2377d9fc (patch)
treefcfbec6c06c4a4052716120f58dd140363339ae0 /app/models/ci/build.rb
parent6e343b27bfb993b2c19dd4b4fd8d2b48747fbac3 (diff)
downloadgitlab-ce-c3e0731d2efc777018b668d9e0b7f8aa2377d9fc.tar.gz
Add case when artifacts have not existed on dependencies
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r--app/models/ci/build.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 965ba35c8b0..9c44e9ef5fd 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -143,9 +143,7 @@ module Ci
end
before_transition any => [:running] do |build|
- if build.specified_dependencies? && build.dependencies.empty?
- raise MissingDependenciesError
- end
+ build.validates_dependencies!
end
end
@@ -486,8 +484,20 @@ module Ci
options[:dependencies]&.empty?
end
- def specified_dependencies?
- options.has_key?(:dependencies) && options[:dependencies].any?
+ def validates_dependencies!
+ 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
def hide_secrets(trace)