summaryrefslogtreecommitdiff
path: root/app/models/ci/build.rb
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-09-04 17:56:49 +0900
committerShinya Maeda <shinya@gitlab.com>2017-12-06 15:53:59 +0900
commit6e343b27bfb993b2c19dd4b4fd8d2b48747fbac3 (patch)
treec44165535bd71c1017f610186105293fba413022 /app/models/ci/build.rb
parent8917726bb5e6746750129c0d9322c2daa7f88172 (diff)
downloadgitlab-ce-6e343b27bfb993b2c19dd4b4fd8d2b48747fbac3.tar.gz
Use Class.new(StandardError) instead of custom extended error class. Bring back specified_dependencies?.
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r--app/models/ci/build.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 119c6fd7b45..965ba35c8b0 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -6,6 +6,8 @@ module Ci
include Presentable
include Importable
+ MissingDependenciesError = Class.new(StandardError)
+
belongs_to :runner
belongs_to :trigger_request
belongs_to :erased_by, class_name: 'User'
@@ -141,8 +143,8 @@ module Ci
end
before_transition any => [:running] do |build|
- if !build.empty_dependencies? && build.dependencies.empty?
- raise Gitlab::Ci::Error::MissingDependencies
+ if build.specified_dependencies? && build.dependencies.empty?
+ raise MissingDependenciesError
end
end
end
@@ -484,6 +486,10 @@ module Ci
options[:dependencies]&.empty?
end
+ def specified_dependencies?
+ options.has_key?(:dependencies) && options[:dependencies].any?
+ end
+
def hide_secrets(trace)
return unless trace